Renamed "target_interface" to "settings_interface" and added property for all attributes
--- a/src/pyams_content/features/renderer/__init__.py Thu Mar 01 17:53:34 2018 +0100
+++ b/src/pyams_content/features/renderer/__init__.py Fri Mar 02 11:20:22 2018 +0100
@@ -46,6 +46,6 @@
def RenderedContentRendererSettingsFactory(context):
"""Rendered content renderer settings factory"""
renderer = IContentRenderer(context)
- if renderer.target_interface is None:
+ if renderer.settings_interface is None:
return None
- return renderer.target_interface(context)
+ return renderer.settings_interface(context)
--- a/src/pyams_content/features/renderer/interfaces/__init__.py Thu Mar 01 17:53:34 2018 +0100
+++ b/src/pyams_content/features/renderer/interfaces/__init__.py Fri Mar 02 11:20:22 2018 +0100
@@ -36,8 +36,8 @@
"""Content renderer interface"""
label = Attribute("Renderer label")
-
- target_interface = Attribute("Renderer target interface")
+ weight = Attribute("Renderer weight")
+ settings_interface = Attribute("Renderer target interface")
class IRendererSettings(Interface):
--- a/src/pyams_content/features/renderer/zmi/__init__.py Thu Mar 01 17:53:34 2018 +0100
+++ b/src/pyams_content/features/renderer/zmi/__init__.py Fri Mar 02 11:20:22 2018 +0100
@@ -37,11 +37,13 @@
class BaseContentRenderer(ContextRequestAdapter):
"""Base content renderer"""
- target_interface = None
+ label = None
+ weight = 0
+ settings_interface = None
@property
def settings(self):
- if self.target_interface is None:
+ if self.settings_interface is None:
return None
return IRendererSettings(self.context)
@@ -62,7 +64,7 @@
@property
def fields(self):
renderer = IContentRenderer(self.context)
- return field.Fields(renderer.target_interface or Interface)
+ return field.Fields(renderer.settings_interface or Interface)
ajax_handler = 'renderer-properties.json'
edit_permission = MANAGE_CONTENT_PERMISSION
--- a/src/pyams_content/features/renderer/zmi/widget.py Thu Mar 01 17:53:34 2018 +0100
+++ b/src/pyams_content/features/renderer/zmi/widget.py Fri Mar 02 11:20:22 2018 +0100
@@ -32,7 +32,7 @@
@property
def show_renderer_properties(self):
renderer = IContentRenderer(self.context)
- return (renderer is not None) and (renderer.target_interface is not None)
+ return (renderer is not None) and (renderer.settings_interface is not None)
def RendererFieldWidget(field, request):