Fixed image_field attributes regression
This commit is contained in:
		| @@ -1,17 +1,16 @@ | |||||||
| import datetime | import datetime | ||||||
| import decimal | import decimal | ||||||
| import re | import re | ||||||
| import sys  |  | ||||||
| import time | import time | ||||||
| import uuid | import uuid | ||||||
| import warnings | import warnings | ||||||
|  | import itertools | ||||||
| from operator import itemgetter | from operator import itemgetter | ||||||
|  |  | ||||||
| import gridfs | import gridfs | ||||||
| from bson import Binary, DBRef, SON, ObjectId | from bson import Binary, DBRef, SON, ObjectId | ||||||
|  |  | ||||||
| from mongoengine.python3_support import (PY3, b, bin_type, | from mongoengine.python3_support import (PY3, bin_type, | ||||||
|                                          txt_type, str_types, StringIO) |                                          txt_type, str_types, StringIO) | ||||||
| from base import (BaseField, ComplexBaseField, ObjectIdField, | from base import (BaseField, ComplexBaseField, ObjectIdField, | ||||||
|                   ValidationError, get_document, BaseDocument) |                   ValidationError, get_document, BaseDocument) | ||||||
| @@ -1212,11 +1211,15 @@ class ImageField(FileField): | |||||||
|         params_size = ('width', 'height', 'force') |         params_size = ('width', 'height', 'force') | ||||||
|         extra_args = dict(size=size, thumbnail_size=thumbnail_size) |         extra_args = dict(size=size, thumbnail_size=thumbnail_size) | ||||||
|         for att_name, att in extra_args.items(): |         for att_name, att in extra_args.items(): | ||||||
|             if att and (isinstance(att, tuple) or isinstance(att, list)): |             value = None | ||||||
|                 setattr(self, att_name, dict( |             if isinstance(att, (tuple, list)): | ||||||
|                         zip(params_size, att))) |                 if PY3: | ||||||
|  |                     value = dict(itertools.zip_longest(params_size, att, | ||||||
|  |                                                         fillvalue=None)) | ||||||
|                 else: |                 else: | ||||||
|                 setattr(self, att_name, None) |                     value = dict(map(None, params_size, att)) | ||||||
|  |  | ||||||
|  |             setattr(self, att_name, value) | ||||||
|  |  | ||||||
|         super(ImageField, self).__init__( |         super(ImageField, self).__init__( | ||||||
|             collection_name=collection_name, |             collection_name=collection_name, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user