--- a/src/pyams_content/shared/common/zmi/workflow.py Tue Oct 30 10:15:29 2018 +0100
+++ b/src/pyams_content/shared/common/zmi/workflow.py Tue Oct 30 11:01:34 2018 +0100
@@ -9,33 +9,32 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
-from pyams_content.features.preview.interfaces import IPreviewTarget
__docformat__ = 'restructuredtext'
-
-# import standard library
from datetime import datetime
-# import interfaces
-from pyams_content.interfaces import PUBLISH_CONTENT_PERMISSION, CREATE_CONTENT_PERMISSION, MANAGE_CONTENT_PERMISSION
-from pyams_content.shared.common.interfaces import IWfSharedContent, IBaseSharedTool, ISharedContent, \
- IContributorRestrictions, IManagerRestrictions
+from pyramid.events import subscriber
+from z3c.form import button, field
+from z3c.form.browser.radio import RadioWidget
+from z3c.form.interfaces import IDataExtractedEvent
+from z3c.form.widget import FieldWidget
+from zope.interface import Interface, Invalid
+from zope.schema import Bool
+
+from pyams_content.features.preview.interfaces import IPreviewTarget
+from pyams_content.interfaces import CREATE_CONTENT_PERMISSION, MANAGE_CONTENT_PERMISSION, PUBLISH_CONTENT_PERMISSION
+from pyams_content.shared.common.interfaces import IBaseSharedTool, IContributorRestrictions, IManagerRestrictions, \
+ ISharedContent, IWfSharedContent
+from pyams_content.workflow import DELETED, DRAFT
+from pyams_form.form import AJAXAddForm, ajax_config
from pyams_form.interfaces import IFormLayer
-from pyams_form.interfaces.form import IWidgetsPrefixViewletsManager, IFormSuffixViewletsManager, IInnerSubForm
-from pyams_security.interfaces import ISecurityManager
-from pyams_skin.layer import IPyAMSLayer
-from pyams_workflow.interfaces import IWorkflowInfo, IWorkflowTransitionInfo, IWorkflowPublicationInfo, \
- IWorkflowCommentInfo, IWorkflowVersions, IWorkflowState, IWorkflow, IWorkflowStateLabel, \
- IWorkflowRequestUrgencyInfo, SYSTEM, MANUAL
-from z3c.form.interfaces import IDataExtractedEvent
-
-# import packages
-from pyams_content.workflow import DRAFT, DELETED
-from pyams_form.form import AJAXAddForm, ajax_config
+from pyams_form.interfaces.form import IFormSuffixViewletsManager, IInnerSubForm, IWidgetsPrefixViewletsManager
from pyams_form.schema import CloseButton
from pyams_form.widget import widgettemplate_config
from pyams_pagelet.pagelet import pagelet_config
+from pyams_security.interfaces import ISecurityManager
+from pyams_skin.layer import IPyAMSLayer
from pyams_template.template import template_config
from pyams_utils.adapter import adapter_config
from pyams_utils.date import format_datetime
@@ -44,15 +43,12 @@
from pyams_utils.timezone import tztime
from pyams_utils.traversing import get_parent
from pyams_utils.url import absolute_url
-from pyams_viewlet.viewlet import viewlet_config, Viewlet
+from pyams_viewlet.viewlet import Viewlet, viewlet_config
+from pyams_workflow.interfaces import IWorkflow, IWorkflowCommentInfo, IWorkflowInfo, IWorkflowPublicationInfo, \
+ IWorkflowRequestUrgencyInfo, IWorkflowState, IWorkflowStateLabel, IWorkflowTransitionInfo, IWorkflowVersions, \
+ MANUAL, SYSTEM
from pyams_workflow.zmi.transition import WorkflowContentTransitionForm
from pyams_zmi.form import InnerAdminAddForm
-from pyramid.events import subscriber
-from z3c.form import field, button
-from z3c.form.browser.radio import RadioWidget
-from z3c.form.widget import FieldWidget
-from zope.interface import Interface, Invalid
-from zope.schema import Bool
from pyams_content import _
@@ -139,11 +135,11 @@
pub_fields = ('publication_effective_date', 'push_end_date', 'publication_expiration_date')
state = IWorkflowState(self.context)
if state.version_id > 1:
- pub_fields += ('displayed_publication_date', )
+ pub_fields += ('displayed_publication_date',)
return field.Fields(IWorkflowTransitionInfo) + \
- field.Fields(IWorkflowPublicationInfo).select(*pub_fields) + \
- field.Fields(IWorkflowRequestUrgencyInfo) + \
- field.Fields(IWorkflowCommentInfo)
+ field.Fields(IWorkflowPublicationInfo).select(*pub_fields) + \
+ field.Fields(IWorkflowRequestUrgencyInfo) + \
+ field.Fields(IWorkflowCommentInfo)
buttons = button.Buttons(IPublicationRequestButtons)
@@ -178,7 +174,7 @@
"""Handle publication request form data extraction"""
data = event.data
if not data.get('publication_effective_date'):
- event.form.widgets.errors += (Invalid(_("Publication start date is required")), )
+ event.form.widgets.errors += (Invalid(_("Publication start date is required")),)
@viewlet_config(name='wf-propose-message', context=IWfSharedContent, layer=IPyAMSLayer, view=PublicationRequestForm,
@@ -271,7 +267,7 @@
"""Handle publication request refuse form data extraction"""
comment = (event.data.get('comment') or '').strip()
if not comment:
- event.form.widgets.errors += (Invalid(_("A comment is required")), )
+ event.form.widgets.errors += (Invalid(_("A comment is required")),)
@viewlet_config(name='wf-refuse-message', context=IWfSharedContent, layer=IPyAMSLayer,
@@ -320,10 +316,10 @@
pub_fields = ('publication_effective_date', 'push_end_date', 'publication_expiration_date')
state = IWorkflowState(self.context)
if state.version_id > 1:
- pub_fields += ('displayed_publication_date', )
+ pub_fields += ('displayed_publication_date',)
return field.Fields(IWorkflowTransitionInfo) + \
- field.Fields(IWorkflowPublicationInfo).select(*pub_fields) + \
- field.Fields(IWorkflowCommentInfo)
+ field.Fields(IWorkflowPublicationInfo).select(*pub_fields) + \
+ field.Fields(IWorkflowCommentInfo)
buttons = button.Buttons(IPublicationButtons)
@@ -360,7 +356,7 @@
"""Handle publication form data extraction"""
data = event.data
if not data.get('publication_effective_date'):
- event.form.widgets.errors += (Invalid(_("Publication start date is required")), )
+ event.form.widgets.errors += (Invalid(_("Publication start date is required")),)
@viewlet_config(name='wf-publish-message', context=IWfSharedContent, layer=IPyAMSLayer,
@@ -402,8 +398,8 @@
"""Shared content publication request refuse form"""
fields = field.Fields(IWorkflowTransitionInfo) + \
- field.Fields(IWorkflowRequestUrgencyInfo) + \
- field.Fields(IWorkflowCommentInfo)
+ field.Fields(IWorkflowRequestUrgencyInfo) + \
+ field.Fields(IWorkflowCommentInfo)
buttons = button.Buttons(IPublicationRetireRequestButtons)
def updateWidgets(self, prefix=None):
@@ -417,7 +413,7 @@
"""Handle publication retire request form data extraction"""
comment = (event.data.get('comment') or '').strip()
if not comment:
- event.form.widgets.errors += (Invalid(_("A comment is required")), )
+ event.form.widgets.errors += (Invalid(_("A comment is required")),)
@viewlet_config(name='wf-retiring-message', context=IWfSharedContent, layer=IPyAMSLayer,
@@ -539,8 +535,8 @@
"""Shared content publication request archive form"""
fields = field.Fields(IWorkflowTransitionInfo) + \
- field.Fields(IWorkflowRequestUrgencyInfo) + \
- field.Fields(IWorkflowCommentInfo)
+ field.Fields(IWorkflowRequestUrgencyInfo) + \
+ field.Fields(IWorkflowCommentInfo)
buttons = button.Buttons(IPublicationArchiveRequestButtons)