--- a/src/pyams_portal/interfaces/__init__.py Mon Jul 09 13:42:42 2018 +0200
+++ b/src/pyams_portal/interfaces/__init__.py Tue Jul 10 08:50:36 2018 +0200
@@ -164,6 +164,8 @@
use_portlets_cache = Attribute("Can renderer use rendering cache?")
use_authentication = Attribute("If 'True', portlet cache entry key is based on current authentication")
+ resources = Attribute("Tuple of Fanstatic resources needed by this renderer")
+
PORTLET_RENDERER_SETTINGS_KEY = 'pyams_portal.renderer.settings::{0}'
--- a/src/pyams_portal/portlet.py Mon Jul 09 13:42:42 2018 +0200
+++ b/src/pyams_portal/portlet.py Tue Jul 10 08:50:36 2018 +0200
@@ -190,6 +190,8 @@
weight = 0
+ resources = ()
+
@property
def slot_configuration(self):
template = IPortalPage(self.context).template
@@ -201,6 +203,11 @@
def renderer_settings(self):
return IPortletRendererSettings(self.settings)
+ def update(self):
+ super(PortletRenderer, self).update()
+ for resource in self.resources:
+ resource.need()
+
def render(self):
preview_mode = self.request.annotations.get(PREVIEW_MODE, False)
if preview_mode or not self.use_portlets_cache: