From a9fc476fb8c7e632aa2df12b98a4ea793d96a51c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wilson=20J=C3=BAnior?= Date: Wed, 2 Nov 2011 09:38:26 -0200 Subject: [PATCH] fixed errors in repr if unicode string is found --- mongoengine/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mongoengine/base.py b/mongoengine/base.py index f22374ba..56c7259b 100644 --- a/mongoengine/base.py +++ b/mongoengine/base.py @@ -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__'):