Added default renderer settings key
authorThierry Florac <thierry.florac@onf.fr>
Wed, 20 Jun 2018 18:13:19 +0200
changeset 126 862e9f6a3cf8
parent 125 193f385c4039
child 127 294f1c0162cc
Added default renderer settings key
src/pyams_portal/interfaces/__init__.py
src/pyams_portal/portlet.py
--- a/src/pyams_portal/interfaces/__init__.py	Wed Jun 20 14:39:23 2018 +0200
+++ b/src/pyams_portal/interfaces/__init__.py	Wed Jun 20 18:13:19 2018 +0200
@@ -159,6 +159,9 @@
     target_interface = Attribute("Target interface provided by this renderer")
 
 
+PORTLET_RENDERER_SETTINGS_KEY = 'pyams_portal.renderer.settings::{0}'
+
+
 class IPortletRendererSettings(Interface):
     """Portlet renderer settings interface"""
 
--- a/src/pyams_portal/portlet.py	Wed Jun 20 14:39:23 2018 +0200
+++ b/src/pyams_portal/portlet.py	Wed Jun 20 18:13:19 2018 +0200
@@ -23,7 +23,7 @@
 from pyams_form.interfaces.form import IFormContextPermissionChecker
 from pyams_portal.interfaces import IPortlet, IPortletSettings, IPortletConfiguration, IPortletPreviewer, \
     IPortletRenderer, IPortalPortletsConfiguration, IPortalTemplate, IPortalContext, IPortalPage, \
-    IPortalTemplateConfiguration, MANAGE_TEMPLATE_PERMISSION, IPortletRendererSettings
+    IPortalTemplateConfiguration, MANAGE_TEMPLATE_PERMISSION, IPortletRendererSettings, PORTLET_RENDERER_SETTINGS_KEY
 from zope.traversing.interfaces import ITraversable
 
 # import packages
@@ -169,7 +169,10 @@
     """Portlet renderer adapter"""
 
     settings_interface = None
-    settings_key = None
+
+    @property
+    def settings_key(self):
+        return PORTLET_RENDERER_SETTINGS_KEY.format(self.settings.renderer)
 
     target_interface = None
 
@@ -182,6 +185,10 @@
         slot_id, slot_name = config.get_portlet_slot(self.settings.configuration.portlet_id)
         return config.get_slot_configuration(slot_name)
 
+    @property
+    def renderer_settings(self):
+        return IPortletRendererSettings(self.settings)
+
 
 @vocabulary_config(name='PyAMS portlet renderers')
 class PortletRenderersVocabulary(SimpleVocabulary):