# HG changeset patch # User Arthur Lutz # Date 1455111785 -3600 # Node ID d1798710f9225acb77a1dc085d57618cbe86b89c # Parent cd1267c1243ec343411debe41a6042ca35c6f19c [exceptions] fix string conversion for Unauthorized exception changeset 3cb87b61b067 changed CubicWebException to define __unicode__ as the main entry point for string conversion, but left Unauthorized's __str__ definition unchanged, leading to a mismatch. Closes #10646396. diff -r cd1267c1243e -r d1798710f922 _exceptions.py --- a/_exceptions.py Mon Feb 08 11:01:46 2016 +0100 +++ b/_exceptions.py Wed Feb 10 14:43:05 2016 +0100 @@ -117,19 +117,19 @@ """raised when a user tries to perform an action without sufficient credentials """ - msg = 'You are not allowed to perform this operation' - msg1 = 'You are not allowed to perform %s operation on %s' + msg = u'You are not allowed to perform this operation' + msg1 = u'You are not allowed to perform %s operation on %s' var = None - def __str__(self): + def __unicode__(self): try: if self.args and len(self.args) == 2: return self.msg1 % self.args if self.args: - return ' '.join(self.args) + return u' '.join(self.args) return self.msg except Exception as ex: - return str(ex) + return text_type(ex) class Forbidden(SecurityError): """raised when a user tries to perform a forbidden action