handle None from model __str__; Fixes #753

This commit is contained in:
Vjacheslav Murashkin
2014-09-04 16:54:23 +04:00
parent 759f72169a
commit 7430b31697
3 changed files with 15 additions and 1 deletions

View File

@@ -229,7 +229,7 @@ class BaseDocument(object):
u = self.__str__()
except (UnicodeEncodeError, UnicodeDecodeError):
u = '[Bad Unicode data]'
repr_type = type(u)
repr_type = str if u is None else type(u)
return repr_type('<%s: %s>' % (self.__class__.__name__, u))
def __str__(self):