cubicweb/_exceptions.py
changeset 11929 fcbd6b251d81
parent 11917 c38e13988c10
child 12342 57e06dd166d4
--- a/cubicweb/_exceptions.py	Mon Jan 23 15:35:19 2017 +0100
+++ b/cubicweb/_exceptions.py	Fri Jan 27 16:26:09 2017 +0100
@@ -21,7 +21,7 @@
 
 from warnings import warn
 
-from six import PY3, text_type
+from six import PY2, text_type
 
 from logilab.common.decorators import cachedproperty
 
@@ -40,7 +40,13 @@
                 return self.msg
         else:
             return u' '.join(text_type(arg) for arg in self.args)
-    __str__ = __unicode__ if PY3 else lambda self: self.__unicode__().encode('utf-8')
+
+    def __str__(self):
+        res = self.__unicode__()
+        if PY2:
+            res = res.encode('utf-8')
+        return res
+
 
 class ConfigurationError(CubicWebException):
     """a misconfiguration error"""