Added protected form object mixin base class to menu dividers to avoid empty menus
authorThierry Florac <thierry.florac@onf.fr>
Fri, 23 Mar 2018 16:21:19 +0100
changeset 497 32f7f9950df3
parent 496 66bae1164f85
child 498 a5fcbde961b9
Added protected form object mixin base class to menu dividers to avoid empty menus
src/pyams_content/component/paragraph/zmi/__init__.py
src/pyams_content/component/paragraph/zmi/html.py
--- a/src/pyams_content/component/paragraph/zmi/__init__.py	Fri Mar 23 11:04:03 2018 +0100
+++ b/src/pyams_content/component/paragraph/zmi/__init__.py	Fri Mar 23 16:21:19 2018 +0100
@@ -111,7 +111,7 @@
 
 @viewlet_config(name='custom-paragraphs.divider', context=IParagraphContainerTarget, view=IParagraphContainerView,
                 layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=500)
-class ParagraphsAddMenuDivider(MenuDivider):
+class ParagraphsAddMenuDivider(ProtectedFormObjectMixin, MenuDivider):
     """Paragraphs add menu divider"""
 
     def __new__(cls, context, request, view, manager):
--- a/src/pyams_content/component/paragraph/zmi/html.py	Fri Mar 23 11:04:03 2018 +0100
+++ b/src/pyams_content/component/paragraph/zmi/html.py	Fri Mar 23 16:21:19 2018 +0100
@@ -39,6 +39,7 @@
     BaseParagraphAddMenu, BaseParagraphPropertiesEditForm
 from pyams_content.component.paragraph.zmi.container import ParagraphContainerTable, \
     ParagraphTitleToolbarViewletManager
+from pyams_form.security import ProtectedFormObjectMixin
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.viewlet.menu import MenuDivider
 from pyams_template.template import template_config
@@ -48,7 +49,7 @@
 from pyams_zmi.form import AdminDialogAddForm
 from pyramid.view import view_config
 from z3c.form import field, button
-from zope.interface import implementer, Interface
+from zope.interface import implementer
 
 from pyams_content import _
 
@@ -59,7 +60,7 @@
 
 @viewlet_config(name='add-raw-paragraph.divider', context=IParagraphContainerTarget, view=IParagraphContainerView,
                 layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=990)
-class RawParagraphAddMenuDivider(MenuDivider):
+class RawParagraphAddMenuDivider(ProtectedFormObjectMixin, MenuDivider):
     """Raw paragraph add menu divider"""
 
     def __new__(cls, context, request, view, manager):