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