--- a/src/pyams_content/component/gallery/interfaces/__init__.py Fri Jul 13 09:23:53 2018 +0200
+++ b/src/pyams_content/component/gallery/interfaces/__init__.py Fri Jul 13 09:24:29 2018 +0200
@@ -88,6 +88,9 @@
default=True)
+GALLERY_FILE_HIDDEN_FIELDS = ('__parent__', '__name__', 'visible')
+
+
class IBaseGallery(IOrderedContainer, IAttributeAnnotatable, IRenderedContent):
"""Base gallery interface"""
--- a/src/pyams_content/component/gallery/zmi/file.py Fri Jul 13 09:23:53 2018 +0200
+++ b/src/pyams_content/component/gallery/zmi/file.py Fri Jul 13 09:24:29 2018 +0200
@@ -9,10 +9,6 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
-from pyramid.renderers import render
-from zope.dublincore.interfaces import IZopeDublinCore
-
-from pyams_skin.event import get_json_refresh_event
__docformat__ = 'restructuredtext'
@@ -20,7 +16,8 @@
# import standard library
# import interfaces
-from pyams_content.component.gallery.interfaces import IGallery, IGalleryFile, IGalleryParagraph
+from pyams_content.component.gallery.interfaces import IGallery, IGalleryFile, IGalleryParagraph, \
+ GALLERY_FILE_HIDDEN_FIELDS
from pyams_content.component.gallery.zmi.interfaces import IGalleryMediasAddFields, IGalleryContentsView
from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
from pyams_file.interfaces.archive import IArchiveExtractor
@@ -41,12 +38,14 @@
from pyams_form.form import AJAXAddForm, ajax_config
from pyams_form.group import NamedWidgetsGroup
from pyams_pagelet.pagelet import pagelet_config
+from pyams_skin.event import get_json_refresh_event
from pyams_skin.viewlet.toolbar import ToolbarAction, JsToolbarActionItem
from pyams_utils.registry import query_utility
from pyams_utils.traversing import get_parent
from pyams_utils.url import absolute_url
from pyams_viewlet.viewlet import viewlet_config
from pyams_zmi.form import AdminDialogEditForm, AdminDialogAddForm
+from pyramid.renderers import render
from z3c.form import field
from zope.lifecycleevent import ObjectCreatedEvent
from zope.location import locate
@@ -184,7 +183,7 @@
icon_css_class = 'fa fa-fw fa-picture-o'
dialog_class = 'modal-large'
- fields = field.Fields(IGalleryFile).omit('__parent__', '__name__', 'visible')
+ fields = field.Fields(IGalleryFile).omit(*GALLERY_FILE_HIDDEN_FIELDS)
edit_permission = MANAGE_CONTENT_PERMISSION
@property
--- a/src/pyams_content/component/gallery/zmi/paragraph.py Fri Jul 13 09:23:53 2018 +0200
+++ b/src/pyams_content/component/gallery/zmi/paragraph.py Fri Jul 13 09:24:29 2018 +0200
@@ -18,7 +18,8 @@
# import interfaces
from pyams_content.component.gallery.interfaces import IGalleryParagraph, IBaseGallery, GALLERY_PARAGRAPH_TYPE
from pyams_content.component.gallery.zmi.interfaces import IGalleryContentsView
-from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer
+from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
+ PARAGRAPH_HIDDEN_FIELDS
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, IInnerSubForm
@@ -69,7 +70,7 @@
legend = _("Add new gallery")
icon_css_class = 'fa fa-fw fa-picture-o'
- fields = field.Fields(IGalleryParagraph).omit('__parent__', '__name__', 'visible')
+ fields = field.Fields(IGalleryParagraph).omit(*PARAGRAPH_HIDDEN_FIELDS)
edit_permission = MANAGE_CONTENT_PERMISSION
def create(self, data):
@@ -91,7 +92,7 @@
legend = _("Edit gallery properties")
icon_css_class = 'fa fa-fw fa-picture-o'
- fields = field.Fields(IGalleryParagraph).omit('__parent__', '__name__', 'visible')
+ fields = field.Fields(IGalleryParagraph).omit(*PARAGRAPH_HIDDEN_FIELDS)
fields['renderer'].widgetFactory = RendererFieldWidget
edit_permission = MANAGE_CONTENT_PERMISSION
--- a/src/pyams_content/component/keynumber/interfaces/__init__.py Fri Jul 13 09:23:53 2018 +0200
+++ b/src/pyams_content/component/keynumber/interfaces/__init__.py Fri Jul 13 09:24:29 2018 +0200
@@ -59,6 +59,9 @@
required=False)
+KEYNUMBER_HIDDEN_FIELDS = ('__parent__', '__name__', 'visible')
+
+
class IKeyNumberContainer(IOrderedContainer):
"""Key numbers container interface"""
--- a/src/pyams_content/component/keynumber/zmi/__init__.py Fri Jul 13 09:23:53 2018 +0200
+++ b/src/pyams_content/component/keynumber/zmi/__init__.py Fri Jul 13 09:24:29 2018 +0200
@@ -17,7 +17,8 @@
import json
# import interfaces
-from pyams_content.component.keynumber.interfaces import IKeyNumberContainer, IKeyNumberContainerTarget, IKeyNumber
+from pyams_content.component.keynumber.interfaces import IKeyNumberContainer, IKeyNumberContainerTarget, IKeyNumber, \
+ KEYNUMBER_HIDDEN_FIELDS
from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
from pyams_form.interfaces.form import IInnerSubForm
from pyams_skin.interfaces.viewlet import IWidgetTitleViewletManager
@@ -229,7 +230,7 @@
legend = _("Add new keynumber")
icon_css_class = 'fa fa-fw fa-dashboard'
- fields = field.Fields(IKeyNumber).omit('__parent__', '__name__', 'visible')
+ fields = field.Fields(IKeyNumber).omit(*KEYNUMBER_HIDDEN_FIELDS)
edit_permission = None # use context permission checker
def create(self, data):
@@ -258,7 +259,7 @@
legend = _("Edit keynumber properties")
icon_css_class = 'fa fa-fw fa-dashboard'
- fields = field.Fields(IKeyNumber).omit('__parent__', '__name__', 'visible')
+ fields = field.Fields(IKeyNumber).omit(*KEYNUMBER_HIDDEN_FIELDS)
edit_permission = None # use context permission checker
def get_ajax_output(self, changes):
--- a/src/pyams_content/shared/imagemap/zmi/paragraph.py Fri Jul 13 09:23:53 2018 +0200
+++ b/src/pyams_content/shared/imagemap/zmi/paragraph.py Fri Jul 13 09:24:29 2018 +0200
@@ -16,7 +16,8 @@
# import standard library
# import interfaces
-from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer
+from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
+ PARAGRAPH_HIDDEN_FIELDS
from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView
from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
from pyams_content.shared.common.interfaces import IWfSharedContent
@@ -67,7 +68,7 @@
legend = _("Add new image map")
icon_css_class = 'fa fa-fw fa-location-arrow'
- fields = field.Fields(IImageMapParagraph).omit('__parent__', '__name__', 'visible')
+ fields = field.Fields(IImageMapParagraph).omit(*PARAGRAPH_HIDDEN_FIELDS)
edit_permission = MANAGE_CONTENT_PERMISSION
def create(self, data):
@@ -94,7 +95,7 @@
legend = _("Edit paragraph properties")
icon_css_class = 'fa fa-fw fa-location-arrow'
- fields = field.Fields(IImageMapParagraph).omit('__parent__', '__name__', 'visible')
+ fields = field.Fields(IImageMapParagraph).omit(*PARAGRAPH_HIDDEN_FIELDS)
fields['renderer'].widgetFactory = RendererFieldWidget
edit_permission = MANAGE_CONTENT_PERMISSION
--- a/src/pyams_content/shared/logo/zmi/paragraph.py Fri Jul 13 09:23:53 2018 +0200
+++ b/src/pyams_content/shared/logo/zmi/paragraph.py Fri Jul 13 09:24:29 2018 +0200
@@ -16,7 +16,8 @@
# import standard library
# import interfaces
-from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer
+from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
+ PARAGRAPH_HIDDEN_FIELDS
from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor
from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
from pyams_content.shared.common import IWfSharedContent
@@ -67,7 +68,7 @@
legend = _("Add new logos paragraph")
icon_css_class = 'fa fa-fw fa-th-large'
- fields = field.Fields(ILogosParagraph).omit('__parent__', '__name__', 'visible')
+ fields = field.Fields(ILogosParagraph).omit(*PARAGRAPH_HIDDEN_FIELDS)
edit_permission = MANAGE_CONTENT_PERMISSION
def create(self, data):
@@ -93,7 +94,7 @@
legend = _("Edit paragraph properties")
icon_css_class = 'fa fa-fw fa-th-large'
- fields = field.Fields(ILogosParagraph).omit('__parent__', '__name__', 'visible')
+ fields = field.Fields(ILogosParagraph).omit(*PARAGRAPH_HIDDEN_FIELDS)
fields['renderer'].widgetFactory = RendererFieldWidget
edit_permission = MANAGE_CONTENT_PERMISSION