Commit d5d358d7 authored by Georgios D. Tsoukalas's avatar Georgios D. Tsoukalas
Browse files

make str(CallError) force unicode to utf8

parent d572aa02
......@@ -32,6 +32,12 @@
# or implied, of GRNET S.A.
def str_or_utf8(s):
if isinstance(s, unicode):
return s.encode('utf8')
return str(s)
class CallError(Exception):
exceptions = {}
......@@ -51,11 +57,11 @@ class CallError(Exception):
self.kwargs = kw
def __str__(self):
return '\n--------\n'.join(str(x) for x in self.args)
return '\n--------\n'.join(str_or_utf8(x) for x in self.args)
def __repr__(self):
return '%s(%s)' % (self.__class__.__name__,
','.join(str(x) for x in self.args))
','.join(str_or_utf8(x) for x in self.args))
def from_exception(cls, exc):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment