For python 2.6, don't try to use Exception.message
bzr revid: p_christ@hol.gr-20090216183933-4w10k79yzal4fcfl
This commit is contained in:
parent
086e4a29c6
commit
f9f9fc5dde
|
@ -692,14 +692,14 @@ def ustr(value):
|
|||
return unicode(value, getlocale()[1])
|
||||
|
||||
def exception_to_unicode(e):
|
||||
if hasattr(e, 'message'):
|
||||
if (sys.version_info[:2] < (2,6)) and hasattr(e, 'message'):
|
||||
return ustr(e.message)
|
||||
if hasattr(e, 'args'):
|
||||
return "\n".join((ustr(a) for a in e.args))
|
||||
try:
|
||||
return ustr(e)
|
||||
except:
|
||||
return u"Unknow message"
|
||||
return u"Unknown message"
|
||||
|
||||
|
||||
# to be compatible with python 2.4
|
||||
|
|
Loading…
Reference in New Issue