Refactored keynumber paragraph
authorThierry Florac <thierry.florac@onf.fr>
Thu, 30 Aug 2018 11:06:45 +0200
changeset 907 d72953216952
parent 906 7478b698af47
child 908 e853c2a81d3f
Refactored keynumber paragraph
src/pyams_content/component/keynumber/interfaces/__init__.py
src/pyams_content/component/keynumber/paragraph.py
src/pyams_content/component/keynumber/zmi/paragraph.py
src/pyams_content/component/paragraph/interfaces/keynumber.py
src/pyams_content/component/paragraph/keynumber.py
src/pyams_content/component/paragraph/zmi/keynumber.py
src/pyams_content/generations/__init__.py
--- a/src/pyams_content/component/keynumber/interfaces/__init__.py	Thu Aug 30 10:04:31 2018 +0200
+++ b/src/pyams_content/component/keynumber/interfaces/__init__.py	Thu Aug 30 11:06:45 2018 +0200
@@ -16,6 +16,7 @@
 # import standard library
 
 # import interfaces
+from pyams_content.component.paragraph.interfaces import IBaseParagraph
 from pyams_content.interfaces.container import IOrderedContainer
 from zope.annotation.interfaces import IAttributeAnnotatable
 
@@ -23,7 +24,7 @@
 from pyams_i18n.schema import I18nTextLineField
 from zope.container.constraints import containers, contains
 from zope.interface import Interface
-from zope.schema import Bool, TextLine
+from zope.schema import Bool, TextLine, Choice
 
 from pyams_content import _
 
@@ -76,3 +77,21 @@
 
 class IKeyNumberContainerTarget(Interface):
     """Key numbers container target interface"""
+
+
+KEYNUMBER_PARAGRAPH_TYPE = 'KeyNumbers'
+KEYNUMBER_PARAGRAPH_NAME = _("Key numbers")
+KEYNUMBER_PARAGRAPH_RENDERERS = 'PyAMS.keynumbers.renderers'
+
+
+#
+# KeyNumber paragraph
+#
+
+class IKeyNumberParagraph(IKeyNumberContainerTarget, IBaseParagraph):
+    """Key numbers paragraph interface"""
+
+    renderer = Choice(title=_("Key numbers template"),
+                      description=_("Presentation template used for key numbers"),
+                      vocabulary=KEYNUMBER_PARAGRAPH_RENDERERS,
+                      default='default')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/component/keynumber/paragraph.py	Thu Aug 30 11:06:45 2018 +0200
@@ -0,0 +1,93 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+from pyams_content.component.paragraph.interfaces import IParagraphFactory
+from pyams_content.component.keynumber.interfaces import KEYNUMBER_PARAGRAPH_TYPE, KEYNUMBER_PARAGRAPH_NAME, \
+    KEYNUMBER_PARAGRAPH_RENDERERS, IKeyNumberParagraph
+from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
+from pyams_i18n.interfaces import II18n, II18nManager, INegotiator
+
+# import packages
+from pyams_content.component.paragraph import BaseParagraph, BaseParagraphFactory, BaseParagraphContentChecker
+from pyams_content.features.renderer import RenderersVocabulary
+from pyams_utils.adapter import adapter_config
+from pyams_utils.factory import factory_config
+from pyams_utils.registry import get_utility, utility_config
+from pyams_utils.request import check_request
+from pyams_utils.traversing import get_parent
+from pyams_utils.vocabulary import vocabulary_config
+from zope.interface import implementer
+from zope.schema.fieldproperty import FieldProperty
+
+
+@implementer(IKeyNumberParagraph)
+@factory_config(provided=IKeyNumberParagraph)
+class KeyNumberParagraph(BaseParagraph):
+    """Key numbers paragraph"""
+
+    icon_class = 'fa-dashboard'
+    icon_hint = KEYNUMBER_PARAGRAPH_NAME
+
+    renderer = FieldProperty(IKeyNumberParagraph['renderer'])
+
+
+@utility_config(name=KEYNUMBER_PARAGRAPH_TYPE, provides=IParagraphFactory)
+class KeyNumberParagraphFactory(BaseParagraphFactory):
+    """Key numbers paragraph factory"""
+
+    name = KEYNUMBER_PARAGRAPH_NAME
+    content_type = KeyNumberParagraph
+
+
+@adapter_config(context=IKeyNumberParagraph, provides=IContentChecker)
+class KeyNumberParagraphContentChecker(BaseParagraphContentChecker):
+    """Key numbers paragraph content checker"""
+
+    @property
+    def label(self):
+        request = check_request()
+        translate = request.localizer.translate
+        return II18n(self.context).query_attribute('title', request) or \
+            '({0})'.format(translate(self.context.icon_hint).lower())
+
+    def inner_check(self, request):
+        output = []
+        translate = request.localizer.translate
+        manager = get_parent(self.context, II18nManager)
+        if manager is not None:
+            langs = manager.get_languages()
+        else:
+            negotiator = get_utility(INegotiator)
+            langs = (negotiator.server_language, )
+        i18n = II18n(self.context)
+        for lang in langs:
+            value = i18n.get_attribute('title', lang, request)
+            if not value:
+                field_title = translate(IKeyNumberParagraph['title'].title)
+                if len(langs) == 1:
+                    output.append(translate(MISSING_VALUE).format(field=field_title))
+                else:
+                    output.append(translate(MISSING_LANG_VALUE).format(field=field_title, lang=lang))
+        return output
+
+
+@vocabulary_config(name=KEYNUMBER_PARAGRAPH_RENDERERS)
+class KeyNumberParagraphRendererVocabulary(RenderersVocabulary):
+    """Key numbers paragraph renderers vocabulary"""
+
+    content_interface = IKeyNumberParagraph
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/component/keynumber/zmi/paragraph.py	Thu Aug 30 11:06:45 2018 +0200
@@ -0,0 +1,125 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+# import standard library
+
+# import interfaces
+from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer
+from pyams_content.component.keynumber.interfaces import KEYNUMBER_PARAGRAPH_TYPE, IKeyNumberParagraph
+from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView
+from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
+from pyams_content.shared.common import IWfSharedContent
+from pyams_form.interfaces.form import IInnerForm
+from pyams_i18n.interfaces import II18n
+from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
+from pyams_skin.layer import IPyAMSLayer
+from z3c.form.interfaces import INPUT_MODE
+
+# import packages
+from pyams_content.component.keynumber.zmi import IKeyNumbersParentForm
+from pyams_content.component.keynumber.paragraph import KeyNumberParagraph
+from pyams_content.component.paragraph.zmi import BaseParagraphAddMenu, BaseParagraphAJAXAddForm, \
+    BaseParagraphPropertiesEditForm, BaseParagraphAJAXEditForm, IParagraphEditFormButtons
+from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
+from pyams_form.form import ajax_config
+from pyams_pagelet.pagelet import pagelet_config
+from pyams_skin.event import get_json_widget_refresh_event
+from pyams_utils.adapter import adapter_config
+from pyams_utils.traversing import get_parent
+from pyams_viewlet.viewlet import viewlet_config
+from pyams_zmi.form import AdminDialogAddForm
+from z3c.form import field, button
+from zope.interface import implementer, Interface
+
+from pyams_content import _
+
+
+@viewlet_config(name='add-keynumber-paragraph.menu', context=IParagraphContainerTarget, view=IParagraphContainerView,
+                layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=600)
+class KeyNumberParagraphAddMenu(BaseParagraphAddMenu):
+    """Key number paragraph add menu"""
+
+    label = _("Key numbers...")
+    label_css_class = 'fa fa-fw fa-dashboard'
+    url = 'add-keynumber-paragraph.html'
+    paragraph_type = KEYNUMBER_PARAGRAPH_TYPE
+
+
+@pagelet_config(name='add-keynumber-paragraph.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,
+                permission=MANAGE_CONTENT_PERMISSION)
+@ajax_config(name='add-keynumber-paragraph.json', context=IParagraphContainerTarget, layer=IPyAMSLayer,
+             base=BaseParagraphAJAXAddForm)
+class KeyNumberParagraphAddForm(AdminDialogAddForm):
+    """Key number paragraph add form"""
+
+    legend = _("Add new key number paragraph")
+    icon_css_class = 'fa fa-fw fa-dashboard'
+
+    fields = field.Fields(IKeyNumberParagraph).select('title', 'renderer')
+    edit_permission = MANAGE_CONTENT_PERMISSION
+
+    def create(self, data):
+        return KeyNumberParagraph()
+
+    def add(self, object):
+        IParagraphContainer(self.context).append(object)
+
+
+@pagelet_config(name='properties.html', context=IKeyNumberParagraph, layer=IPyAMSLayer,
+                permission=MANAGE_CONTENT_PERMISSION)
+@ajax_config(name='properties.json', context=IKeyNumberParagraph, layer=IPyAMSLayer,
+             base=BaseParagraphAJAXEditForm)
+@implementer(IKeyNumbersParentForm)
+class KeyNumberParagraphPropertiesEditForm(BaseParagraphPropertiesEditForm):
+    """Key number paragraph properties edit form"""
+
+    prefix = 'keynumbers_properties.'
+
+    @property
+    def title(self):
+        content = get_parent(self.context, IWfSharedContent)
+        return II18n(content).query_attribute('title', request=self.request)
+
+    legend = _("Edit key number paragraph properties")
+    icon_css_class = 'fa fa-fw fa-dashboard'
+
+    fields = field.Fields(IKeyNumberParagraph).select('title', 'renderer')
+    fields['renderer'].widgetFactory = RendererFieldWidget
+
+    edit_permission = MANAGE_CONTENT_PERMISSION
+
+
+@adapter_config(context=(IKeyNumberParagraph, IPyAMSLayer), provides=IParagraphInnerEditor)
+@ajax_config(name='inner-properties.json', context=IKeyNumberParagraph, layer=IPyAMSLayer,
+             base=BaseParagraphAJAXEditForm)
+@implementer(IInnerForm, IKeyNumbersParentForm)
+class KeyNumberParagraphInnerEditForm(KeyNumberParagraphPropertiesEditForm):
+    """Key number paragraph inner edit form"""
+
+    legend = None
+
+    @property
+    def buttons(self):
+        if self.mode == INPUT_MODE:
+            return button.Buttons(IParagraphEditFormButtons)
+        else:
+            return button.Buttons()
+
+    def get_ajax_output(self, changes):
+        output = super(self.__class__, self).get_ajax_output(changes)
+        updated = changes.get(IKeyNumberParagraph, ())
+        if 'renderer' in updated:
+            output.setdefault('events', []).append(
+                get_json_widget_refresh_event(self.context, self.request, KeyNumberParagraphInnerEditForm, 'renderer'))
+        return output
--- a/src/pyams_content/component/paragraph/interfaces/keynumber.py	Thu Aug 30 10:04:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-#
-# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-
-__docformat__ = 'restructuredtext'
-
-
-# import standard library
-
-# import interfaces
-from pyams_content.component.keynumber.interfaces import IKeyNumberContainerTarget
-from pyams_content.component.paragraph import IBaseParagraph
-
-# import packages
-from zope.schema import Bool, Choice, TextLine
-
-from pyams_content import _
-
-
-KEYNUMBER_PARAGRAPH_TYPE = 'KeyNumbers'
-KEYNUMBER_PARAGRAPH_NAME = _("Key numbers")
-KEYNUMBER_PARAGRAPH_RENDERERS = 'PyAMS.keynumbers.renderers'
-
-
-class IKeyNumberParagraph(IKeyNumberContainerTarget, IBaseParagraph):
-    """Key numbers paragraph interface"""
-
-    renderer = Choice(title=_("Key numbers template"),
-                      description=_("Presentation template used for key numbers"),
-                      vocabulary=KEYNUMBER_PARAGRAPH_RENDERERS,
-                      default='default')
--- a/src/pyams_content/component/paragraph/keynumber.py	Thu Aug 30 10:04:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-#
-# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-
-__docformat__ = 'restructuredtext'
-
-
-# import standard library
-
-# import interfaces
-from pyams_content.component.paragraph.interfaces import IParagraphFactory
-from pyams_content.component.paragraph.interfaces.keynumber import IKeyNumberParagraph, KEYNUMBER_PARAGRAPH_TYPE, \
-    KEYNUMBER_PARAGRAPH_RENDERERS, KEYNUMBER_PARAGRAPH_NAME
-from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
-from pyams_i18n.interfaces import II18n, II18nManager, INegotiator
-
-# import packages
-from pyams_content.component.paragraph import BaseParagraph, BaseParagraphFactory, BaseParagraphContentChecker
-from pyams_content.features.renderer import RenderersVocabulary
-from pyams_utils.adapter import adapter_config
-from pyams_utils.factory import factory_config
-from pyams_utils.registry import get_utility, utility_config
-from pyams_utils.request import check_request
-from pyams_utils.traversing import get_parent
-from pyams_utils.vocabulary import vocabulary_config
-from zope.interface import implementer
-from zope.schema.fieldproperty import FieldProperty
-
-
-@implementer(IKeyNumberParagraph)
-@factory_config(provided=IKeyNumberParagraph)
-class KeyNumberParagraph(BaseParagraph):
-    """Key numbers paragraph"""
-
-    icon_class = 'fa-dashboard'
-    icon_hint = KEYNUMBER_PARAGRAPH_NAME
-
-    renderer = FieldProperty(IKeyNumberParagraph['renderer'])
-
-
-@utility_config(name=KEYNUMBER_PARAGRAPH_TYPE, provides=IParagraphFactory)
-class KeyNumberParagraphFactory(BaseParagraphFactory):
-    """Key numbers paragraph factory"""
-
-    name = KEYNUMBER_PARAGRAPH_NAME
-    content_type = KeyNumberParagraph
-
-
-@adapter_config(context=IKeyNumberParagraph, provides=IContentChecker)
-class KeyNumberParagraphContentChecker(BaseParagraphContentChecker):
-    """Key numbers paragraph content checker"""
-
-    @property
-    def label(self):
-        request = check_request()
-        translate = request.localizer.translate
-        return II18n(self.context).query_attribute('title', request) or \
-            '({0})'.format(translate(self.context.icon_hint).lower())
-
-    def inner_check(self, request):
-        output = []
-        translate = request.localizer.translate
-        manager = get_parent(self.context, II18nManager)
-        if manager is not None:
-            langs = manager.get_languages()
-        else:
-            negotiator = get_utility(INegotiator)
-            langs = (negotiator.server_language, )
-        i18n = II18n(self.context)
-        for lang in langs:
-            value = i18n.get_attribute('title', lang, request)
-            if not value:
-                field_title = translate(IKeyNumberParagraph['title'].title)
-                if len(langs) == 1:
-                    output.append(translate(MISSING_VALUE).format(field=field_title))
-                else:
-                    output.append(translate(MISSING_LANG_VALUE).format(field=field_title, lang=lang))
-        return output
-
-
-@vocabulary_config(name=KEYNUMBER_PARAGRAPH_RENDERERS)
-class KeyNumberParagraphRendererVocabulary(RenderersVocabulary):
-    """Key numbers paragraph renderers vocabulary"""
-
-    content_interface = IKeyNumberParagraph
--- a/src/pyams_content/component/paragraph/zmi/keynumber.py	Thu Aug 30 10:04:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-#
-# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-
-__docformat__ = 'restructuredtext'
-
-
-# import standard library
-
-# import interfaces
-from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer
-from pyams_content.component.paragraph.interfaces.keynumber import KEYNUMBER_PARAGRAPH_TYPE, IKeyNumberParagraph
-from pyams_content.component.paragraph.zmi import IParagraphContainerView, IParagraphEditFormButtons
-from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor
-from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
-from pyams_content.shared.common import IWfSharedContent
-from pyams_form.interfaces.form import IInnerForm
-from pyams_i18n.interfaces import II18n
-from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
-from pyams_skin.layer import IPyAMSLayer
-from z3c.form.interfaces import INPUT_MODE
-
-# import packages
-from pyams_content.component.keynumber.zmi import IKeyNumbersParentForm
-from pyams_content.component.paragraph.keynumber import KeyNumberParagraph
-from pyams_content.component.paragraph.zmi import BaseParagraphAddMenu, BaseParagraphAJAXAddForm, \
-    BaseParagraphPropertiesEditForm, BaseParagraphAJAXEditForm
-from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
-from pyams_form.form import ajax_config
-from pyams_pagelet.pagelet import pagelet_config
-from pyams_skin.event import get_json_widget_refresh_event
-from pyams_utils.adapter import adapter_config
-from pyams_utils.traversing import get_parent
-from pyams_viewlet.viewlet import viewlet_config
-from pyams_zmi.form import AdminDialogAddForm
-from z3c.form import field, button
-from zope.interface import implementer, Interface
-
-from pyams_content import _
-
-
-@viewlet_config(name='add-keynumber-paragraph.menu', context=IParagraphContainerTarget, view=IParagraphContainerView,
-                layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=600)
-class KeyNumberParagraphAddMenu(BaseParagraphAddMenu):
-    """Key number paragraph add menu"""
-    
-    label = _("Key numbers...")
-    label_css_class = 'fa fa-fw fa-dashboard'
-    url = 'add-keynumber-paragraph.html'
-    paragraph_type = KEYNUMBER_PARAGRAPH_TYPE
-    
-    
-@pagelet_config(name='add-keynumber-paragraph.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,
-                permission=MANAGE_CONTENT_PERMISSION)
-@ajax_config(name='add-keynumber-paragraph.json', context=IParagraphContainerTarget, layer=IPyAMSLayer,
-             base=BaseParagraphAJAXAddForm)
-class KeyNumberParagraphAddForm(AdminDialogAddForm):
-    """Key number paragraph add form"""
-    
-    legend = _("Add new key number paragraph")
-    icon_css_class = 'fa fa-fw fa-dashboard'
-    
-    fields = field.Fields(IKeyNumberParagraph).select('title', 'renderer')
-    edit_permission = MANAGE_CONTENT_PERMISSION
-    
-    def create(self, data):
-        return KeyNumberParagraph()
-    
-    def add(self, object):
-        IParagraphContainer(self.context).append(object)
-
-    
-@pagelet_config(name='properties.html', context=IKeyNumberParagraph, layer=IPyAMSLayer,
-                permission=MANAGE_CONTENT_PERMISSION)
-@ajax_config(name='properties.json', context=IKeyNumberParagraph, layer=IPyAMSLayer,
-             base=BaseParagraphAJAXEditForm)
-@implementer(IKeyNumbersParentForm)
-class KeyNumberParagraphPropertiesEditForm(BaseParagraphPropertiesEditForm):
-    """Key number paragraph properties edit form"""
-
-    prefix = 'keynumbers_properties.'
-
-    @property
-    def title(self):
-        content = get_parent(self.context, IWfSharedContent)
-        return II18n(content).query_attribute('title', request=self.request)
-
-    legend = _("Edit key number paragraph properties")
-    icon_css_class = 'fa fa-fw fa-dashboard'
-
-    fields = field.Fields(IKeyNumberParagraph).select('title', 'renderer')
-    fields['renderer'].widgetFactory = RendererFieldWidget
-
-    edit_permission = MANAGE_CONTENT_PERMISSION
-
-
-@adapter_config(context=(IKeyNumberParagraph, IPyAMSLayer), provides=IParagraphInnerEditor)
-@ajax_config(name='inner-properties.json', context=IKeyNumberParagraph, layer=IPyAMSLayer,
-             base=BaseParagraphAJAXEditForm)
-@implementer(IInnerForm, IKeyNumbersParentForm)
-class KeyNumberParagraphInnerEditForm(KeyNumberParagraphPropertiesEditForm):
-    """Key number paragraph inner edit form"""
-
-    legend = None
-
-    @property
-    def buttons(self):
-        if self.mode == INPUT_MODE:
-            return button.Buttons(IParagraphEditFormButtons)
-        else:
-            return button.Buttons()
-
-    def get_ajax_output(self, changes):
-        output = super(self.__class__, self).get_ajax_output(changes)
-        updated = changes.get(IKeyNumberParagraph, ())
-        if 'renderer' in updated:
-            output.setdefault('events', []).append(
-                get_json_widget_refresh_event(self.context, self.request, KeyNumberParagraphInnerEditForm, 'renderer'))
-        return output
--- a/src/pyams_content/generations/__init__.py	Thu Aug 30 10:04:31 2018 +0200
+++ b/src/pyams_content/generations/__init__.py	Thu Aug 30 11:06:45 2018 +0200
@@ -71,6 +71,8 @@
         'pyams_content.component.keynumber KeyNumber',
     'pyams_content.component.paragraph.keynumber KeyNumberContainer':
         'pyams_content.component.keynumber KeyNumberContainer',
+    'pyams_content.component.paragraph.keynumber KeyNumberParagraph':
+        'pyams_content.component.keynumber.paragraph KeyNumberParagraph',
     'pyams_content.portlet.content SharedContentPortletSettings':
         'pyams_content.shared.common.portlet.content SharedContentPortletSettings',
     'pyams_content.portlet.navigation SimpleNavigationPortletSettings':