diff --git a/imagekit/models/fields/__init__.py b/imagekit/models/fields/__init__.py index 517c94e..148212c 100644 --- a/imagekit/models/fields/__init__.py +++ b/imagekit/models/fields/__init__.py @@ -20,14 +20,7 @@ class ImageSpecField(SpecHost): image_cache_backend=None, image_cache_strategy=None, spec=None, id=None): - # The spec accepts a callable value for processors, but it - # takes different arguments than the callable that ImageSpecField - # expects, so we create a partial application and pass that instead. - # TODO: Should we change the signatures to match? Even if `instance` is not part of the signature, it's accessible through the source file object's instance property. - p = lambda file: processors(instance=file.instance, - file=file) if callable(processors) else processors - - SpecHost.__init__(self, processors=p, format=format, + SpecHost.__init__(self, processors=processors, format=format, options=options, storage=storage, autoconvert=autoconvert, image_cache_backend=image_cache_backend, image_cache_strategy=image_cache_strategy, spec=spec, diff --git a/imagekit/specs/__init__.py b/imagekit/specs/__init__.py index a86eb95..cdb5638 100644 --- a/imagekit/specs/__init__.py +++ b/imagekit/specs/__init__.py @@ -92,16 +92,10 @@ class BaseImageSpec(object): self.options = options or self.options self.autoconvert = self.autoconvert if autoconvert is None else autoconvert - def get_processors(self, source_file): - processors = self.processors - if callable(processors): - processors = processors(source_file) - return processors - def get_hash(self, source_file): return md5(''.join([ source_file.name, - pickle.dumps(self.get_processors(source_file)), + pickle.dumps(self.processors), self.format, pickle.dumps(self.options), str(self.autoconvert), @@ -125,7 +119,7 @@ class BaseImageSpec(object): original_format = img.format # Run the processors - processors = self.get_processors(source_file) + processors = self.processors img = ProcessorPipeline(processors or []).process(img) options = dict(self.options or {})