--- a/src/pyams_content/component/paragraph/zmi/__init__.py Wed Sep 04 16:06:18 2019 +0200
+++ b/src/pyams_content/component/paragraph/zmi/__init__.py Mon Sep 16 16:57:01 2019 +0200
@@ -10,17 +10,16 @@
# FOR A PARTICULAR PURPOSE.
#
-__docformat__ = 'restructuredtext'
-
from pyramid.decorator import reify
from pyramid.location import lineage
from z3c.form import button, field
from zope.interface import Interface
from pyams_content.component.paragraph import IParagraphContainer, IParagraphTitle
-from pyams_content.component.paragraph.interfaces import IBaseParagraph, IParagraphContainerTarget, IParagraphFactory, \
- IParagraphFactorySettings, IParagraphRenderer, PARAGRAPH_HIDDEN_FIELDS
-from pyams_content.component.paragraph.zmi.container import ParagraphContainerBaseTable, ParagraphContainerTable
+from pyams_content.component.paragraph.interfaces import IBaseParagraph, IParagraphContainerTarget, \
+ IParagraphFactory, IParagraphFactorySettings, IParagraphRenderer, PARAGRAPH_HIDDEN_FIELDS
+from pyams_content.component.paragraph.zmi.container import ParagraphContainerBaseTable, \
+ ParagraphContainerTable
from pyams_content.component.paragraph.zmi.interfaces import IParagraphContainerView
from pyams_content.features.renderer.zmi import BaseRenderedContentRenderer
from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
@@ -49,6 +48,9 @@
from pyams_zmi.interfaces.menu import IPropertiesMenu
from pyams_zmi.layer import IAdminLayer
+
+__docformat__ = 'restructuredtext'
+
from pyams_content import _
@@ -56,8 +58,9 @@
# Default paragraphs settings
#
-@viewlet_config(name='default-paragraphs.menu', context=IParagraphFactorySettings, layer=IAdminLayer,
- manager=IPropertiesMenu, permission=MANAGE_TOOL_PERMISSION, weight=10)
+@viewlet_config(name='default-paragraphs.menu', context=IParagraphFactorySettings,
+ layer=IAdminLayer, manager=IPropertiesMenu, permission=MANAGE_TOOL_PERMISSION,
+ weight=10)
class DefaultParagraphsSettingsMenu(MenuItem):
"""Default paragraphs settings menu"""
@@ -67,8 +70,8 @@
modal_target = True
-@pagelet_config(name='default-paragraphs.html', context=IParagraphFactorySettings, layer=IPyAMSLayer,
- permission=MANAGE_TOOL_PERMISSION)
+@pagelet_config(name='default-paragraphs.html', context=IParagraphFactorySettings,
+ layer=IPyAMSLayer, permission=MANAGE_TOOL_PERMISSION)
@ajax_config(name='default-paragraphs.json', context=IParagraphFactorySettings, layer=IPyAMSLayer)
class DefaultParagraphsEditForm(AdminDialogEditForm):
"""Default paragraphs edit form"""
@@ -81,13 +84,16 @@
edit_permission = MANAGE_TOOL_PERMISSION
-@adapter_config(context=(IParagraphFactorySettings, IPyAMSLayer, DefaultParagraphsEditForm), provides=IFormHelp)
+@adapter_config(context=(IParagraphFactorySettings, IPyAMSLayer, DefaultParagraphsEditForm),
+ provides=IFormHelp)
class DefaultParagraphsEditFormHelp(FormHelp):
"""Default paragraphs edit form help"""
message = _("You can define which types of paragraphs are allowed in this container.\n\n"
- "Default paragraphs will be added automatically (in selected order) to any new created content.\n\n"
- "NOTICE: removing types from allowed types list will have no effect on already created contents!")
+ "Default paragraphs will be added automatically (in selected order) to any new "
+ "created content.\n\n"
+ "NOTICE: removing types from allowed types list will have no effect on already "
+ "created contents!")
message_format = 'rest'
@@ -115,7 +121,8 @@
}
-def get_json_paragraph_toolbar_refresh_event(context, request, table_factory=None, viewlet_factory=None):
+def get_json_paragraph_toolbar_refresh_event(context, request, table_factory=None,
+ viewlet_factory=None):
"""Get JSON response value for paragraph toolbar refresh event"""
if table_factory is None:
from pyams_content.component.paragraph.zmi.container \
@@ -139,7 +146,8 @@
}
-def get_json_paragraph_markers_refresh_event(context, request, form, viewlet_factory, marker_type=None):
+def get_json_paragraph_markers_refresh_event(context, request, form, viewlet_factory,
+ marker_type=None):
"""Get JSON response value for paragraph markers refresh event"""
parent = get_parent(context, IParagraphContainerTarget)
if parent is not None:
@@ -165,13 +173,15 @@
def __new__(cls, context, request, view, manager):
settings = get_parent(context, IParagraphFactorySettings)
- if (settings is not None) and (cls.paragraph_type not in (settings.allowed_paragraphs or ())):
+ if (settings is not None) and (
+ cls.paragraph_type not in (settings.allowed_paragraphs or ())):
return None
return ToolbarMenuItem.__new__(cls)
-@viewlet_config(name='custom-paragraphs.divider', context=IParagraphContainerTarget, view=IParagraphContainerView,
- layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=500)
+@viewlet_config(name='custom-paragraphs.divider', context=IParagraphContainerTarget,
+ view=IParagraphContainerView, layer=IPyAMSLayer, manager=IToolbarAddingMenu,
+ weight=500)
class ParagraphsAddMenuDivider(ProtectedFormObjectMixin, MenuDivider):
"""Paragraphs add menu divider"""
@@ -317,14 +327,16 @@
renderer_interface = self.widgets['renderer'].field.interface
if 'renderer' in changes.get(renderer_interface, ()):
output.setdefault('events', []).append(
- get_json_widget_refresh_event(self.context, self.request, self.__class__, 'renderer'))
+ get_json_widget_refresh_event(self.context, self.request, self.__class__,
+ 'renderer'))
renderer = self.context.get_renderer(self.request)
if (renderer is not None) and \
(renderer.settings_interface is not None):
output['smallbox'] = {
'status': 'info',
- 'message': self.request.localizer.translate(_("You changed renderer selection. Don't omit to "
- "update new renderer properties...")),
+ 'message': self.request.localizer.translate(
+ _("You changed renderer selection. Don't omit to "
+ "update new renderer properties...")),
'timeout': 5000
}
return output