Fixed image_field attributes regression
This commit is contained in:
parent
91aa90ad4a
commit
c1619d2a62
@ -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)))
|
||||
value = None
|
||||
if isinstance(att, (tuple, list)):
|
||||
if PY3:
|
||||
value = dict(itertools.zip_longest(params_size, att,
|
||||
fillvalue=None))
|
||||
else:
|
||||
setattr(self, att_name, None)
|
||||
value = dict(map(None, params_size, att))
|
||||
|
||||
setattr(self, att_name, value)
|
||||
|
||||
super(ImageField, self).__init__(
|
||||
collection_name=collection_name,
|
||||
|
Loading…
x
Reference in New Issue
Block a user