Merge branch 'master' into 0.8
Conflicts: AUTHORS mongoengine/base.py tests/test_dereference.py
This commit is contained in:
commit
76fddd0db0
1
AUTHORS
1
AUTHORS
@ -139,6 +139,7 @@ that much better:
|
|||||||
* lraucy
|
* lraucy
|
||||||
* hellysmile
|
* hellysmile
|
||||||
* Jaepil Jeong
|
* Jaepil Jeong
|
||||||
|
* Daniil Sharou
|
||||||
* Stefan Wójcik
|
* Stefan Wójcik
|
||||||
* Pete Campton
|
* Pete Campton
|
||||||
* Martyn Smith
|
* Martyn Smith
|
||||||
|
@ -51,6 +51,7 @@ Changes in 0.8.X
|
|||||||
|
|
||||||
Changes in 0.7.10
|
Changes in 0.7.10
|
||||||
=================
|
=================
|
||||||
|
- Fix UnicodeEncodeError for dbref (#278)
|
||||||
- Allow construction using positional parameters (#268)
|
- Allow construction using positional parameters (#268)
|
||||||
- Updated EmailField length to support long domains (#243)
|
- Updated EmailField length to support long domains (#243)
|
||||||
- Added 64-bit integer support (#251)
|
- Added 64-bit integer support (#251)
|
||||||
|
@ -115,7 +115,7 @@ class DeReference(object):
|
|||||||
object_map = {}
|
object_map = {}
|
||||||
for col, dbrefs in self.reference_map.iteritems():
|
for col, dbrefs in self.reference_map.iteritems():
|
||||||
keys = object_map.keys()
|
keys = object_map.keys()
|
||||||
refs = list(set([dbref for dbref in dbrefs if str(dbref) not in keys]))
|
refs = list(set([dbref for dbref in dbrefs if unicode(dbref).encode('utf-8') not in keys]))
|
||||||
if hasattr(col, 'objects'): # We have a document class for the refs
|
if hasattr(col, 'objects'): # We have a document class for the refs
|
||||||
references = col.objects.in_bulk(refs)
|
references = col.objects.in_bulk(refs)
|
||||||
for key, doc in references.iteritems():
|
for key, doc in references.iteritems():
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
import sys
|
import sys
|
||||||
sys.path[0:0] = [""]
|
sys.path[0:0] = [""]
|
||||||
@ -1153,5 +1154,29 @@ class FieldTest(unittest.TestCase):
|
|||||||
self.assertTrue(tuple(x.items[0]) in tuples)
|
self.assertTrue(tuple(x.items[0]) in tuples)
|
||||||
self.assertTrue(x.items[0] in tuples)
|
self.assertTrue(x.items[0] in tuples)
|
||||||
|
|
||||||
|
def test_non_ascii_pk(self):
|
||||||
|
"""
|
||||||
|
Ensure that dbref conversion to string does not fail when
|
||||||
|
non-ascii characters are used in primary key
|
||||||
|
"""
|
||||||
|
class Brand(Document):
|
||||||
|
title = StringField(max_length=255, primary_key=True)
|
||||||
|
|
||||||
|
class BrandGroup(Document):
|
||||||
|
title = StringField(max_length=255, primary_key=True)
|
||||||
|
brands = SortedListField(ReferenceField("Brand", dbref=True))
|
||||||
|
|
||||||
|
Brand.drop_collection()
|
||||||
|
BrandGroup.drop_collection()
|
||||||
|
|
||||||
|
brand1 = Brand(title="Moschino").save()
|
||||||
|
brand2 = Brand(title=u"Денис Симачёв").save()
|
||||||
|
|
||||||
|
BrandGroup(title="top_brands", brands=[brand1, brand2]).save()
|
||||||
|
brand_groups = BrandGroup.objects().all()
|
||||||
|
|
||||||
|
self.assertEqual(2, len([brand for bg in brand_groups for brand in bg.brands]))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user