[entropy.exceptions] expose __unicode__ builtin method in EntropyException

This commit is contained in:
Fabio Erculiani
2009-11-30 10:23:10 +01:00
parent 279f5ab4bb
commit 4e042c631f
+6 -1
View File
@@ -11,7 +11,7 @@
This module contains Entropy Framework exceptions classes.
"""
from entropy.const import const_isstring
from entropy.const import const_isstring, const_convert_to_unicode
class DumbException(Exception):
"""Dumb exception class"""
@@ -22,6 +22,11 @@ class EntropyException(Exception):
self.value = value[:]
Exception.__init__(self)
def __unicode__(self):
if const_isstring(self.value):
return const_convert_to_unicode(self.value)
return const_convert_to_unicode(repr(self.value))
def __str__(self):
if const_isstring(self.value):
return self.value