Fixed error in Binary Field
This commit is contained in:
parent
2801b38c75
commit
f99b7a811b
@ -2,6 +2,10 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
Changes in 0.6.X
|
||||||
|
================
|
||||||
|
- Fixed BinaryField lookup re (MongoEngine/mongoengine#48)
|
||||||
|
|
||||||
Changes in 0.6.19
|
Changes in 0.6.19
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
@ -1327,7 +1327,7 @@ class UUIDField(BaseField):
|
|||||||
super(UUIDField, self).__init__(**kwargs)
|
super(UUIDField, self).__init__(**kwargs)
|
||||||
|
|
||||||
def to_python(self, value):
|
def to_python(self, value):
|
||||||
if not self.binary:
|
if not self._binary:
|
||||||
if not isinstance(value, basestring):
|
if not isinstance(value, basestring):
|
||||||
value = unicode(value)
|
value = unicode(value)
|
||||||
return uuid.UUID(value)
|
return uuid.UUID(value)
|
||||||
|
@ -283,6 +283,7 @@ class FieldTest(unittest.TestCase):
|
|||||||
uu = uuid.uuid4()
|
uu = uuid.uuid4()
|
||||||
Person(api_key=uu).save()
|
Person(api_key=uu).save()
|
||||||
self.assertEqual(1, Person.objects(api_key=uu).count())
|
self.assertEqual(1, Person.objects(api_key=uu).count())
|
||||||
|
self.assertEqual(uu, Person.objects.first().api_key)
|
||||||
|
|
||||||
person = Person()
|
person = Person()
|
||||||
valid = (uuid.uuid4(), uuid.uuid1())
|
valid = (uuid.uuid4(), uuid.uuid1())
|
||||||
@ -307,6 +308,7 @@ class FieldTest(unittest.TestCase):
|
|||||||
uu = uuid.uuid4()
|
uu = uuid.uuid4()
|
||||||
Person(api_key=uu).save()
|
Person(api_key=uu).save()
|
||||||
self.assertEqual(1, Person.objects(api_key=uu).count())
|
self.assertEqual(1, Person.objects(api_key=uu).count())
|
||||||
|
self.assertEqual(uu, Person.objects.first().api_key)
|
||||||
|
|
||||||
person = Person()
|
person = Person()
|
||||||
valid = (uuid.uuid4(), uuid.uuid1())
|
valid = (uuid.uuid4(), uuid.uuid1())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user