src/pyams_content/component/illustration/zmi/paragraph.py
changeset 432 a068d20dc9ae
parent 415 43f42d74cdb8
child 487 093f201e3168
--- a/src/pyams_content/component/illustration/zmi/paragraph.py	Fri Mar 02 15:02:52 2018 +0100
+++ b/src/pyams_content/component/illustration/zmi/paragraph.py	Fri Mar 02 15:35:17 2018 +0100
@@ -33,10 +33,11 @@
 from pyams_content.component.illustration.paragraph import Illustration
 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
     BaseParagraphAddMenu, BaseParagraphPropertiesEditForm
+from pyams_content.features.renderer.zmi import BaseRenderedContentPreview
 from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_utils.adapter import adapter_config
-from pyams_viewlet.viewlet import viewlet_config, BaseContentProvider
+from pyams_viewlet.viewlet import viewlet_config
 from pyams_zmi.form import AdminDialogAddForm
 from pyramid.view import view_config
 from z3c.form import field, button
@@ -190,22 +191,5 @@
 #
 
 @adapter_config(context=(IIllustrationParagraph, IPyAMSLayer), provides=IParagraphPreview)
-class IllustrationPreview(BaseContentProvider):
+class IllustrationPreview(BaseRenderedContentPreview):
     """Illustration preview"""
-
-    def __init__(self, context, request):
-        super(IllustrationPreview, self).__init__(context, request)
-        self.renderer = self.context.get_renderer()
-
-    language = None
-
-    def update(self):
-        if self.renderer is not None:
-            self.renderer.language = self.language
-            self.renderer.update()
-
-    def render(self):
-        if self.renderer is not None:
-            return self.renderer.render()
-        else:
-            return ''