fix validator of BinaryField. In fact bson.Binary fails if we give it unicode in input #273
This commit is contained in:
		| @@ -1460,10 +1460,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') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user