Added renderer resources
authorThierry Florac <thierry.florac@onf.fr>
Thu, 19 Jul 2018 17:19:50 +0200
changeset 867 17c1149151aa
parent 866 62633f571e53
child 868 1fcd5c845d1d
Added renderer resources
src/pyams_content/features/renderer/interfaces/__init__.py
src/pyams_content/features/renderer/skin/__init__.py
--- a/src/pyams_content/features/renderer/interfaces/__init__.py	Thu Jul 19 17:14:24 2018 +0200
+++ b/src/pyams_content/features/renderer/interfaces/__init__.py	Thu Jul 19 17:19:50 2018 +0200
@@ -39,9 +39,14 @@
     """Content renderer interface"""
 
     label = Attribute("Renderer label")
-    weight = Attribute("Renderer weight")
-    settings_interface = Attribute("Renderer target interface")
+    weight = Attribute("Renderer weight, used for ordering")
+
+    settings_interface = Attribute("Renderer settings interface")
+    resources = Attribute("Iterable of needed Fanstatic resources")
+
     language = Attribute("Renderer language (if forced)")
+    context_attrs = Attribute("Context attributes defined into renderer")
+    i18n_context_attrs = Attribute("I18n context attributes defined into renderer")
 
 
 class ISharedContentRenderer(IContentRenderer):
--- a/src/pyams_content/features/renderer/skin/__init__.py	Thu Jul 19 17:14:24 2018 +0200
+++ b/src/pyams_content/features/renderer/skin/__init__.py	Thu Jul 19 17:19:50 2018 +0200
@@ -36,7 +36,9 @@
 
     label = None
     weight = 0
+
     settings_interface = None
+    resources = ()
 
     language = None
     context_attrs = ()
@@ -49,6 +51,8 @@
         return IRendererSettings(self.context)
 
     def update(self):
+        for resource in self.resources:
+            resource.need()
         for attr in self.context_attrs:
             setattr(self, attr, getattr(self.context, attr, None))
         if self.i18n_context_attrs: