diff --git a/imagekit/imagecache/strategies.py b/imagekit/imagecache/strategies.py index 4a3d618..cb7edd4 100644 --- a/imagekit/imagecache/strategies.py +++ b/imagekit/imagecache/strategies.py @@ -1,3 +1,4 @@ +from django.utils.functional import LazyObject from .actions import validate_now, clear_now from ..utils import get_singleton @@ -36,7 +37,7 @@ class DictStrategy(object): setattr(self, k, v) -class StrategyWrapper(object): +class StrategyWrapper(LazyObject): def __init__(self, strategy): if isinstance(strategy, basestring): strategy = get_singleton(strategy, 'image cache strategy') diff --git a/imagekit/registry.py b/imagekit/registry.py index d74f6b1..764ba24 100644 --- a/imagekit/registry.py +++ b/imagekit/registry.py @@ -90,6 +90,7 @@ class SourceGroupRegistry(object): Relay source group signals to the appropriate spec strategy. """ + from .files import GeneratedImageCacheFile source_group = sender # Ignore signals from unregistered groups. @@ -101,7 +102,8 @@ class SourceGroupRegistry(object): callback_name = self._signals[signal] for spec in specs: - call_strategy_method(spec, callback_name, file=source) + file = GeneratedImageCacheFile(spec) + call_strategy_method(spec, callback_name, file=file) class CacheableRegistry(object):