For python 2.6, don't try to use Exception.message
authorP. Christeas <p_christ@hol.gr>
Mon, 16 Feb 2009 18:39:33 +0000 (20:39 +0200)
committerP. Christeas <p_christ@hol.gr>
Mon, 16 Feb 2009 18:39:33 +0000 (20:39 +0200)
bzr revid: p_christ@hol.gr-20090216183933-4w10k79yzal4fcfl

bin/tools/misc.py

index 8863a8c..cba90e6 100644 (file)
@@ -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