Kaydet (Commit) dbb63e56 authored tarafından Aymeric Augustin's avatar Aymeric Augustin

[py3] Avoided returning bytes in Model.__str__

on Python 3.
üst 9e7b5ba5
...@@ -407,7 +407,7 @@ class Model(six.with_metaclass(ModelBase, object)): ...@@ -407,7 +407,7 @@ class Model(six.with_metaclass(ModelBase, object)):
return smart_bytes('<%s: %s>' % (self.__class__.__name__, u)) return smart_bytes('<%s: %s>' % (self.__class__.__name__, u))
def __str__(self): def __str__(self):
if hasattr(self, '__unicode__'): if not six.PY3 and hasattr(self, '__unicode__'):
return force_text(self).encode('utf-8') return force_text(self).encode('utf-8')
return '%s object' % self.__class__.__name__ return '%s object' % self.__class__.__name__
......
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