src/pyams_content/component/illustration/zmi/paragraph.py
changeset 395 2a39b333a585
parent 368 7cc109b71105
child 406 5527bc086216
--- a/src/pyams_content/component/illustration/zmi/paragraph.py	Sun Feb 11 12:11:05 2018 +0100
+++ b/src/pyams_content/component/illustration/zmi/paragraph.py	Thu Feb 15 15:08:29 2018 +0100
@@ -18,7 +18,7 @@
 # import interfaces
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, \
     IParagraphContainer, IParagraphSummary
-from pyams_content.component.illustration.interfaces import IIllustrationRenderer, IIllustration, IIllustrationParagraph
+from pyams_content.component.illustration.interfaces import IIllustration, IIllustrationParagraph
 from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_form.interfaces.form import IInnerForm, IEditFormButtons
@@ -32,6 +32,7 @@
 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.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
@@ -99,6 +100,8 @@
     icon_css_class = 'fa fa-fw fa-file-image-o'
 
     fields = field.Fields(IIllustrationParagraph).omit('__parent__', '__name__', 'visible')
+    fields['renderer'].widgetFactory = RendererFieldWidget
+
     ajax_handler = 'properties.json'
     edit_permission = MANAGE_CONTENT_PERMISSION
 
@@ -191,8 +194,7 @@
 
     def __init__(self, context, request):
         super(IllustrationSummary, self).__init__(context, request)
-        self.renderer = request.registry.queryMultiAdapter((context, request), IIllustrationRenderer,
-                                                           name=self.context.renderer)
+        self.renderer = self.context.get_renderer()
 
     language = None