Added protected form object mixin base class to menu dividers to avoid empty menus
--- 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):