Changed paragraph summary base class
authorThierry Florac <thierry.florac@onf.fr>
Wed, 13 Sep 2017 12:30:05 +0200
changeset 160 ff4fc5786058
parent 159 544331dc946f
child 161 a5545e09b203
Changed paragraph summary base class
src/pyams_content/component/association/zmi/paragraph.py
src/pyams_content/component/illustration/zmi/paragraph.py
src/pyams_content/component/paragraph/zmi/header.py
src/pyams_content/component/paragraph/zmi/html.py
--- a/src/pyams_content/component/association/zmi/paragraph.py	Wed Sep 13 12:28:47 2017 +0200
+++ b/src/pyams_content/component/association/zmi/paragraph.py	Wed Sep 13 12:30:05 2017 +0200
@@ -37,10 +37,10 @@
 from pyams_form.security import ProtectedFormObjectMixin
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.viewlet.toolbar import ToolbarMenuItem
-from pyams_template.template import template_config, get_view_template
-from pyams_utils.adapter import adapter_config, ContextRequestAdapter
+from pyams_template.template import template_config
+from pyams_utils.adapter import adapter_config
 from pyams_utils.traversing import get_parent
-from pyams_viewlet.viewlet import viewlet_config
+from pyams_viewlet.viewlet import viewlet_config, BaseContentProvider
 from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
 from pyramid.view import view_config
 from z3c.form import field, button
@@ -130,7 +130,7 @@
 
 @adapter_config(context=(IAssociationParagraph, IPyAMSLayer), provides=IParagraphSummary)
 @template_config(template='templates/paragraph-summary.pt', layer=IPyAMSLayer)
-class AssociationParagraphSummary(ContextRequestAdapter):
+class AssociationParagraphSummary(BaseContentProvider):
     """Association paragraph renderer"""
 
     language = None
@@ -147,5 +147,3 @@
         self.associations = [{'url': item.get_url(self.request),
                               'title': IAssociationInfo(item).user_title}
                              for item in IAssociationContainer(self.context).values() if item.visible]
-
-    render = get_view_template()
--- a/src/pyams_content/component/illustration/zmi/paragraph.py	Wed Sep 13 12:28:47 2017 +0200
+++ b/src/pyams_content/component/illustration/zmi/paragraph.py	Wed Sep 13 12:30:05 2017 +0200
@@ -36,9 +36,9 @@
 from pyams_form.security import ProtectedFormObjectMixin
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.viewlet.toolbar import ToolbarMenuItem
-from pyams_utils.adapter import ContextRequestAdapter, adapter_config
+from pyams_utils.adapter import adapter_config
 from pyams_utils.traversing import get_parent
-from pyams_viewlet.viewlet import viewlet_config
+from pyams_viewlet.viewlet import viewlet_config, BaseContentProvider
 from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
 from pyramid.view import view_config
 from z3c.form import field, button
@@ -188,7 +188,7 @@
 #
 
 @adapter_config(context=(IIllustrationParagraph, IPyAMSLayer), provides=IParagraphSummary)
-class IllustrationSummary(ContextRequestAdapter):
+class IllustrationSummary(BaseContentProvider):
     """Illustration renderer"""
 
     def __init__(self, context, request):
--- a/src/pyams_content/component/paragraph/zmi/header.py	Wed Sep 13 12:28:47 2017 +0200
+++ b/src/pyams_content/component/paragraph/zmi/header.py	Wed Sep 13 12:30:05 2017 +0200
@@ -35,10 +35,10 @@
 from pyams_form.security import ProtectedFormObjectMixin
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.viewlet.toolbar import ToolbarMenuItem
-from pyams_template.template import template_config, get_view_template
-from pyams_utils.adapter import adapter_config, ContextRequestAdapter
+from pyams_template.template import template_config
+from pyams_utils.adapter import adapter_config
 from pyams_utils.traversing import get_parent
-from pyams_viewlet.viewlet import viewlet_config
+from pyams_viewlet.viewlet import viewlet_config, BaseContentProvider
 from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
 from pyramid.view import view_config
 from z3c.form import field, button
@@ -152,7 +152,7 @@
 
 @adapter_config(context=(IHeaderParagraph, IPyAMSLayer), provides=IParagraphSummary)
 @template_config(template='templates/header-summary.pt', layer=IPyAMSLayer)
-class HeaderParagraphSummary(ContextRequestAdapter):
+class HeaderParagraphSummary(BaseContentProvider):
     """Header paragraph renderer"""
 
     language = None
@@ -165,5 +165,3 @@
         else:
             for attr in ('header', ):
                 setattr(self, attr, i18n.query_attribute(attr, request=self.request))
-
-    render = get_view_template()
--- a/src/pyams_content/component/paragraph/zmi/html.py	Wed Sep 13 12:28:47 2017 +0200
+++ b/src/pyams_content/component/paragraph/zmi/html.py	Wed Sep 13 12:30:05 2017 +0200
@@ -39,10 +39,11 @@
 from pyams_form.security import ProtectedFormObjectMixin
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.viewlet.toolbar import ToolbarMenuItem
-from pyams_template.template import template_config, get_view_template
-from pyams_utils.adapter import adapter_config, ContextRequestAdapter
+from pyams_template.template import template_config
+
+from pyams_utils.adapter import adapter_config
 from pyams_utils.traversing import get_parent
-from pyams_viewlet.viewlet import viewlet_config
+from pyams_viewlet.viewlet import viewlet_config, BaseContentProvider
 from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
 from pyramid.threadlocal import get_current_registry
 from pyramid.view import view_config
@@ -191,8 +192,8 @@
 
 @adapter_config(context=(IHTMLParagraph, IPyAMSLayer), provides=IParagraphSummary)
 @template_config(template='templates/html-summary.pt', layer=IPyAMSLayer)
-class HTMLParagraphSummary(ContextRequestAdapter):
-    """HTML paragraph renderer"""
+class HTMLParagraphSummary(BaseContentProvider):
+    """HTML paragraph summary"""
 
     illustration = None
     illustration_renderer = None
@@ -215,8 +216,6 @@
             if renderer is not None:
                 renderer.update()
 
-    render = get_view_template()
-
     def render_illustration(self):
         if not self.illustration_renderer:
             return ''