Fix source callbacks on strategies

This commit is contained in:
Matthew Tretter 2013-01-29 01:48:06 -05:00
parent 3931b552a0
commit ca4f090e63
2 changed files with 5 additions and 2 deletions

View file

@ -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')

View file

@ -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):