mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-05-23 11:45:51 +00:00
Fix source callbacks on strategies
This commit is contained in:
parent
3931b552a0
commit
ca4f090e63
2 changed files with 5 additions and 2 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
from django.utils.functional import LazyObject
|
||||||
from .actions import validate_now, clear_now
|
from .actions import validate_now, clear_now
|
||||||
from ..utils import get_singleton
|
from ..utils import get_singleton
|
||||||
|
|
||||||
|
|
@ -36,7 +37,7 @@ class DictStrategy(object):
|
||||||
setattr(self, k, v)
|
setattr(self, k, v)
|
||||||
|
|
||||||
|
|
||||||
class StrategyWrapper(object):
|
class StrategyWrapper(LazyObject):
|
||||||
def __init__(self, strategy):
|
def __init__(self, strategy):
|
||||||
if isinstance(strategy, basestring):
|
if isinstance(strategy, basestring):
|
||||||
strategy = get_singleton(strategy, 'image cache strategy')
|
strategy = get_singleton(strategy, 'image cache strategy')
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ class SourceGroupRegistry(object):
|
||||||
Relay source group signals to the appropriate spec strategy.
|
Relay source group signals to the appropriate spec strategy.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from .files import GeneratedImageCacheFile
|
||||||
source_group = sender
|
source_group = sender
|
||||||
|
|
||||||
# Ignore signals from unregistered groups.
|
# Ignore signals from unregistered groups.
|
||||||
|
|
@ -101,7 +102,8 @@ class SourceGroupRegistry(object):
|
||||||
callback_name = self._signals[signal]
|
callback_name = self._signals[signal]
|
||||||
|
|
||||||
for spec in specs:
|
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):
|
class CacheableRegistry(object):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue