| @@ -838,11 +838,10 @@ class BinaryField(BaseField): | |||||||
|         return Binary(value) |         return Binary(value) | ||||||
|  |  | ||||||
|     def to_python(self, value): |     def to_python(self, value): | ||||||
|         # Returns str not unicode as this is binary data |         return "%s" % value | ||||||
|         return str(value) |  | ||||||
|  |  | ||||||
|     def validate(self, value): |     def validate(self, value): | ||||||
|         if not isinstance(value, str): |         if not isinstance(value, basestring): | ||||||
|             self.error('BinaryField only accepts string values') |             self.error('BinaryField only accepts string values') | ||||||
|  |  | ||||||
|         if self.max_bytes is not None and len(value) > self.max_bytes: |         if self.max_bytes is not None and len(value) > self.max_bytes: | ||||||
| @@ -1014,7 +1013,7 @@ class FileField(BaseField): | |||||||
|  |  | ||||||
|     def __set__(self, instance, value): |     def __set__(self, instance, value): | ||||||
|         key = self.name |         key = self.name | ||||||
|         if (hasattr(value, 'read') and not isinstance(value, GridFSProxy)) or isinstance(value, str): |         if (hasattr(value, 'read') and not isinstance(value, GridFSProxy)) or isinstance(value, basestring): | ||||||
|             # using "FileField() = file/string" notation |             # using "FileField() = file/string" notation | ||||||
|             grid_file = instance._data.get(self.name) |             grid_file = instance._data.get(self.name) | ||||||
|             # If a file already exists, delete it |             # If a file already exists, delete it | ||||||
|   | |||||||
| @@ -702,7 +702,7 @@ class QuerySet(object): | |||||||
|                 cleaned_fields = [] |                 cleaned_fields = [] | ||||||
|                 for field in fields: |                 for field in fields: | ||||||
|                     append_field = True |                     append_field = True | ||||||
|                     if isinstance(field, str): |                     if isinstance(field, basestring): | ||||||
|                         parts.append(field) |                         parts.append(field) | ||||||
|                         append_field = False |                         append_field = False | ||||||
|                     else: |                     else: | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								setup.cfg
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								setup.cfg
									
									
									
									
									
								
							| @@ -4,10 +4,10 @@ test = nosetests | |||||||
| [nosetests] | [nosetests] | ||||||
| verbosity = 2 | verbosity = 2 | ||||||
| detailed-errors = 1 | detailed-errors = 1 | ||||||
| with-coverage = 1 | #with-coverage = 1 | ||||||
| cover-erase = 1 | #cover-erase = 1 | ||||||
| cover-html = 1 | #cover-html = 1 | ||||||
| cover-html-dir = ../htmlcov | #cover-html-dir = ../htmlcov | ||||||
| cover-package = mongoengine | #cover-package = mongoengine | ||||||
| where = tests | where = tests | ||||||
| #tests = test_bugfix.py | #tests = test_bugfix.py | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user