kopia lustrzana https://github.com/wagtail/wagtail
Remove unnecessary caching of image operations
rodzic
9b02147d3e
commit
a6b13ee559
|
@ -390,17 +390,19 @@ class Filter:
|
||||||
@cached_property
|
@cached_property
|
||||||
def operations(self):
|
def operations(self):
|
||||||
# Search for operations
|
# Search for operations
|
||||||
self._search_for_operations()
|
registered_operations = {}
|
||||||
|
for fn in hooks.get_hooks('register_image_operations'):
|
||||||
|
registered_operations.update(dict(fn()))
|
||||||
|
|
||||||
# Build list of operation objects
|
# Build list of operation objects
|
||||||
operations = []
|
operations = []
|
||||||
for op_spec in self.spec.split('|'):
|
for op_spec in self.spec.split('|'):
|
||||||
op_spec_parts = op_spec.split('-')
|
op_spec_parts = op_spec.split('-')
|
||||||
|
|
||||||
if op_spec_parts[0] not in self._registered_operations:
|
if op_spec_parts[0] not in registered_operations:
|
||||||
raise InvalidFilterSpecError("Unrecognised operation: %s" % op_spec_parts[0])
|
raise InvalidFilterSpecError("Unrecognised operation: %s" % op_spec_parts[0])
|
||||||
|
|
||||||
op_class = self._registered_operations[op_spec_parts[0]]
|
op_class = registered_operations[op_spec_parts[0]]
|
||||||
operations.append(op_class(*op_spec_parts))
|
operations.append(op_class(*op_spec_parts))
|
||||||
return operations
|
return operations
|
||||||
|
|
||||||
|
@ -484,19 +486,6 @@ class Filter:
|
||||||
|
|
||||||
return hashlib.sha1(vary_string.encode('utf-8')).hexdigest()[:8]
|
return hashlib.sha1(vary_string.encode('utf-8')).hexdigest()[:8]
|
||||||
|
|
||||||
_registered_operations = None
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def _search_for_operations(cls):
|
|
||||||
if cls._registered_operations is not None:
|
|
||||||
return
|
|
||||||
|
|
||||||
operations = []
|
|
||||||
for fn in hooks.get_hooks('register_image_operations'):
|
|
||||||
operations.extend(fn())
|
|
||||||
|
|
||||||
cls._registered_operations = dict(operations)
|
|
||||||
|
|
||||||
|
|
||||||
class AbstractRendition(models.Model):
|
class AbstractRendition(models.Model):
|
||||||
filter_spec = models.CharField(max_length=255, db_index=True)
|
filter_spec = models.CharField(max_length=255, db_index=True)
|
||||||
|
|
Ładowanie…
Reference in New Issue