Skip to content

Commit

Permalink
Merge pull request #65 from collective/alecm-purge-cache-on-crop
Browse files Browse the repository at this point in the history
Implement proxy cache purging when updating image crops.
  • Loading branch information
tomgross committed Aug 12, 2015
2 parents 2c21092 + 2437242 commit b0e66ff
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog
1.3 (unreleased)
----------------

- Purge proxy caches if needed on crop.
[alecm]

- Fix issue with crops disappearing for non-blob images (e.g. ATNewsItem images)
[alecm]

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
'zope.interface',
'zope.lifecycleevent',
'zope.schema',
'z3c.caching',
],
extras_require={
'test': [
Expand Down
1 change: 0 additions & 1 deletion src/plone/app/imagecropping/at.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from zope.annotation.interfaces import IAnnotations
from zope.component import adapter
from zope.interface import implementer
from zope.interface.declarations import providedBy
from zope.publisher.interfaces import IRequest
import time

Expand Down
5 changes: 5 additions & 0 deletions src/plone/app/imagecropping/browser/crop.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from plone.app.imagecropping import PAI_STORAGE_KEY
from plone.app.imagecropping.interfaces import IImageCroppingUtils
from plone.scale.storage import AnnotationStorage
from z3c.caching.purge import Purge
from zope.annotation.interfaces import IAnnotations
from zope.event import notify

import PIL.Image

Expand Down Expand Up @@ -42,6 +44,9 @@ def _crop(self, fieldname, scale, box):
# store crop information in annotations
self._store(fieldname, scale, box)

# Purge caches if needed
notify(Purge(self.context))

@property
def _storage(self):
return IAnnotations(self.context).setdefault(
Expand Down

0 comments on commit b0e66ff

Please sign in to comment.