mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-03-16 21:30:23 +00:00
Don't require spec to be created up-front
This commit is contained in:
parent
ce08448207
commit
5a1dd0c459
1 changed files with 14 additions and 13 deletions
|
|
@ -176,21 +176,22 @@ class SpecHost(object):
|
|||
storage=None, autoconvert=None, image_cache_backend=None,
|
||||
image_cache_strategy=None, spec=None, spec_id=None):
|
||||
|
||||
if spec:
|
||||
if any([processors, format, options, storage, autoconvert,
|
||||
image_cache_backend, image_cache_strategy]):
|
||||
spec_args = dict(
|
||||
processors=processors,
|
||||
format=format,
|
||||
options=options,
|
||||
storage=storage,
|
||||
autoconvert=autoconvert,
|
||||
image_cache_backend=image_cache_backend,
|
||||
image_cache_strategy=image_cache_strategy,
|
||||
)
|
||||
|
||||
if any(v is not None for v in spec_args.values()):
|
||||
if spec:
|
||||
raise TypeError('You can provide either an image spec or'
|
||||
' arguments for the ImageSpec constructor, but not both.')
|
||||
else:
|
||||
spec = ImageSpec(
|
||||
processors=processors,
|
||||
format=format,
|
||||
options=options,
|
||||
storage=storage,
|
||||
autoconvert=autoconvert,
|
||||
image_cache_backend=image_cache_backend,
|
||||
image_cache_strategy=image_cache_strategy,
|
||||
)
|
||||
else:
|
||||
spec = ImageSpec(**spec_args)
|
||||
|
||||
self._original_spec = spec
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue