Merge branch 'master' of https://github.com/MongoEngine/mongoengine into generic_ref_field_changed

This commit is contained in:
Bastien Gérard
2018-10-30 23:21:19 +01:00
2 changed files with 18 additions and 21 deletions

View File

@@ -1475,10 +1475,10 @@ class BinaryField(BaseField):
return Binary(value)
def validate(self, value):
if not isinstance(value, (six.binary_type, six.text_type, Binary)):
if not isinstance(value, (six.binary_type, Binary)):
self.error('BinaryField only accepts instances of '
'(%s, %s, Binary)' % (
six.binary_type.__name__, six.text_type.__name__))
six.binary_type.__name__, Binary.__name__))
if self.max_bytes is not None and len(value) > self.max_bytes:
self.error('Binary value is too long')