Handles unicode correctly EmbeddedDocumentListField
This commit is contained in:
parent
3b1509f307
commit
109202329f
@ -210,7 +210,7 @@ class EmbeddedDocumentList(BaseList):
|
||||
def __match_all(cls, i, kwargs):
|
||||
items = kwargs.items()
|
||||
return all([
|
||||
getattr(i, k) == v or str(getattr(i, k)) == v for k, v in items
|
||||
getattr(i, k) == v or unicode(getattr(i, k)) == v for k, v in items
|
||||
])
|
||||
|
||||
@classmethod
|
||||
|
@ -4033,6 +4033,17 @@ class EmbeddedDocumentListFieldTestCase(unittest.TestCase):
|
||||
# modified
|
||||
self.assertEqual(number, 2)
|
||||
|
||||
def test_unicode(self):
|
||||
"""
|
||||
Tests that unicode strings handled correctly
|
||||
"""
|
||||
post = self.BlogPost(comments=[
|
||||
self.Comments(author='user1', message=u'сообщение'),
|
||||
self.Comments(author='user2', message=u'хабарлама')
|
||||
]).save()
|
||||
self.assertEqual(post.comments.get(message=u'сообщение').author,
|
||||
'user1')
|
||||
|
||||
def test_save(self):
|
||||
"""
|
||||
Tests the save method of a List of Embedded Documents.
|
||||
|
Loading…
x
Reference in New Issue
Block a user