--- a/src/pyams_workflow/interfaces.py Thu May 23 16:47:00 2019 +0200
+++ b/src/pyams_workflow/interfaces.py Fri May 24 08:45:15 2019 +0200
@@ -12,21 +12,16 @@
__docformat__ = 'restructuredtext'
-
-# import standard library
-
-# import interfaces
-from pyams_utils.interfaces import VIEW_PERMISSION
from zope.annotation.interfaces import IAttributeAnnotatable
+from zope.interface import Attribute, Interface, Invalid, implementer, invariant
from zope.interface.interfaces import IObjectEvent, ObjectEvent
+from zope.lifecycleevent import ObjectCreatedEvent
from zope.lifecycleevent.interfaces import IObjectCreatedEvent
+from zope.schema import Bool, Choice, Datetime, Int, List, Object, Set, Text, TextLine
+from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
-# import packages
from pyams_security.schema import Principal
-from zope.interface import implementer, invariant, Interface, Attribute, Invalid
-from zope.lifecycleevent import ObjectCreatedEvent
-from zope.schema import Choice, Datetime, Set, TextLine, Text, List, Object, Int, Bool
-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
+from pyams_utils.interfaces import VIEW_PERMISSION
from pyams_workflow import _
@@ -201,6 +196,9 @@
"""Get transition with transition_id"""
+WORKFLOWS_VOCABULARY = 'PyAMS workflows'
+
+
class IWorkflowInfo(Interface):
"""Get workflow info about workflowed object, and drive workflow.
@@ -373,7 +371,7 @@
workflow_name = Choice(title=_("Workflow name"),
description=_("Name of workflow utility managing this content"),
required=True,
- vocabulary='PyAMS workflows')
+ vocabulary=WORKFLOWS_VOCABULARY)
view_permission = Choice(title=_("View permission"),
description=_("This permission will be required to display content"),
--- a/src/pyams_workflow/workflow.py Thu May 23 16:47:00 2019 +0200
+++ b/src/pyams_workflow/workflow.py Fri May 24 08:45:15 2019 +0200
@@ -12,25 +12,21 @@
__docformat__ = 'restructuredtext'
-
-# import standard library
-
-# import interfaces
-from pyams_workflow.interfaces import MANUAL, SYSTEM, AUTOMATIC, IWorkflow, InvalidTransitionError, IWorkflowState, \
- IWorkflowVersions, IWorkflowVersion, IWorkflowInfo, IWorkflowManagedContent, WorkflowVersionTransitionEvent, \
- WorkflowTransitionEvent, ConditionFailedError, NoTransitionAvailableError, AmbiguousTransitionError
-
-# import packages
-from pyams_utils.adapter import adapter_config
-from pyams_utils.registry import get_utility, get_global_registry
-from pyams_utils.request import check_request, query_request
-from pyams_utils.traversing import get_parent
-from pyams_utils.vocabulary import vocabulary_config
from pyramid.httpexceptions import HTTPUnauthorized
from zope.componentvocabulary.vocabulary import UtilityVocabulary
from zope.interface import implementer
from zope.lifecycleevent import ObjectModifiedEvent
+from pyams_utils.adapter import adapter_config
+from pyams_utils.registry import get_global_registry, get_utility
+from pyams_utils.request import check_request, query_request
+from pyams_utils.traversing import get_parent
+from pyams_utils.vocabulary import vocabulary_config
+from pyams_workflow.interfaces import AUTOMATIC, AmbiguousTransitionError, ConditionFailedError, IWorkflow, \
+ IWorkflowInfo, IWorkflowManagedContent, IWorkflowState, IWorkflowVersion, IWorkflowVersions, InvalidTransitionError, \
+ MANUAL, NoTransitionAvailableError, SYSTEM, WORKFLOWS_VOCABULARY, WorkflowTransitionEvent, \
+ WorkflowVersionTransitionEvent
+
from pyams_workflow import _
@@ -282,7 +278,7 @@
return [transition for transition in transitions if transition.trigger == trigger]
-@vocabulary_config(name='PyAMS workflows')
+@vocabulary_config(name=WORKFLOWS_VOCABULARY)
class WorkflowsVocabulary(UtilityVocabulary):
"""Workflows vocabulary"""