fixed errors in repr if unicode string is found

This commit is contained in:
Wilson Júnior 2011-11-02 09:38:26 -02:00
parent 26f0c06624
commit a9fc476fb8

View File

@ -1080,10 +1080,10 @@ class BaseDocument(object):
def __repr__(self):
try:
u = unicode(self)
u = unicode(self).encode('utf-8')
except (UnicodeEncodeError, UnicodeDecodeError):
u = '[Bad Unicode data]'
return u'<%s: %s>' % (self.__class__.__name__, u)
return '<%s: %s>' % (self.__class__.__name__, u)
def __str__(self):
if hasattr(self, '__unicode__'):