summaryrefslogtreecommitdiffstats
path: root/tabellio/webviews/slidernews.py
diff options
context:
space:
mode:
Diffstat (limited to 'tabellio/webviews/slidernews.py')
-rw-r--r--tabellio/webviews/slidernews.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tabellio/webviews/slidernews.py b/tabellio/webviews/slidernews.py
index 781f667..65022c0 100644
--- a/tabellio/webviews/slidernews.py
+++ b/tabellio/webviews/slidernews.py
@@ -10,6 +10,11 @@ from plone.formwidget.contenttree import ObjPathSourceBinder
from plone.app.textfield import RichText
from plone.namedfile.field import NamedImage
+try:
+ from plone.app.caching.operations.utils import setCacheHeaders
+except ImportError:
+ setCacheHeaders = None
+
from tabellio.webviews import MessageFactory as _
class ISliderNews(form.Schema):
@@ -27,4 +32,8 @@ class View(grok.View):
class PictureView(BrowserView):
def __call__(self):
self.request.response.setHeader('Content-type', self.context.picture.contentType)
+ if setCacheHeaders:
+ setCacheHeaders(self, self.request, self.request.response,
+ maxage=3600, smaxage=3600,
+ lastModified=self.context.modification_date.asdatetime())
return self.context.picture.data