Merge pull request #348 from wpjunior/patch-2

fixes for __repr__ documents
This commit is contained in:
Ross Lawley 2011-11-02 04:54:08 -07:00
commit 81bf5cb78b

View File

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