summaryrefslogtreecommitdiffstats
path: root/tabellio/webviews/misc.py
diff options
context:
space:
mode:
Diffstat (limited to 'tabellio/webviews/misc.py')
-rw-r--r--tabellio/webviews/misc.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/tabellio/webviews/misc.py b/tabellio/webviews/misc.py
index 255a00d..7a926e4 100644
--- a/tabellio/webviews/misc.py
+++ b/tabellio/webviews/misc.py
@@ -6,20 +6,30 @@ from zope import component
from Products.CMFCore.utils import getToolByName
+try:
+ from plone.app.caching.operations.utils import setCacheHeaders
+except ImportError:
+ setCacheHeaders = None
+
from tabellio.agenda.utils import MonthlyView
+class Cached:
+ def cache(self, duration=3600):
+ if setCacheHeaders:
+ setCacheHeaders(self, self.request, self.request.response,
+ maxage=duration, smaxage=duration)
class IFolderWithBottomNavView(Interface):
pass
-class FolderWithBottomNavView(BrowserView):
+class FolderWithBottomNavView(BrowserView, Cached):
pass
class IPressFolder(Interface):
pass
-class PressFolder(BrowserView):
+class PressFolder(BrowserView, Cached):
def getRecent(self):
catalog = getToolByName(self.context, 'portal_catalog')
folder_path = '/'.join(self.context.getPhysicalPath() + ('communiques',))
@@ -32,7 +42,7 @@ class PressFolder(BrowserView):
class IPcfHomeFolder(Interface):
pass
-class PcfHomeFolder(BrowserView):
+class PcfHomeFolder(BrowserView, Cached):
def slider_items(self):
catalog = getToolByName(self.context, 'portal_catalog')
objects = catalog(portal_type=['tabellio.webviews.slidernews'])
@@ -153,14 +163,14 @@ class PcfHomeFolder(BrowserView):
class IComiteMixteFolder(Interface):
pass
-class ComiteMixteFolder(BrowserView):
+class ComiteMixteFolder(BrowserView, Cached):
pass
class IFolderWithRecentDocs(Interface):
pass
-class FolderWithRecentDocs(BrowserView):
+class FolderWithRecentDocs(BrowserView, Cached):
def last_docs(self):
catalog = getToolByName(self.context, 'portal_catalog')
return catalog(
@@ -170,5 +180,6 @@ class FolderWithRecentDocs(BrowserView):
class IFolderNoNoNav(Interface):
pass
-class FolderNoNoNav(BrowserView):
+class FolderNoNoNav(BrowserView, Cached):
pass
+