BinaryField returns str not unicode
This commit is contained in:
@@ -505,10 +505,11 @@ class BinaryField(BaseField):
|
||||
return pymongo.binary.Binary(value)
|
||||
|
||||
def to_python(self, value):
|
||||
return unicode(value)
|
||||
# Returns str not unicode as this is binary data
|
||||
return str(value)
|
||||
|
||||
def validate(self, value):
|
||||
assert isinstance(value, str)
|
||||
|
||||
if self.max_bytes is not None and len(value) > self.max_bytes:
|
||||
raise ValidationError('Binary value is too long')
|
||||
raise ValidationError('Binary value is too long')
|
||||
|
||||
Reference in New Issue
Block a user