src/pyams_workflow/interfaces.py
changeset 99 6136a9a4f380
parent 98 c69e5c38e92c
equal deleted inserted replaced
98:c69e5c38e92c 99:6136a9a4f380
    10 # FOR A PARTICULAR PURPOSE.
    10 # FOR A PARTICULAR PURPOSE.
    11 #
    11 #
    12 
    12 
    13 __docformat__ = 'restructuredtext'
    13 __docformat__ = 'restructuredtext'
    14 
    14 
    15 
    15 from zope.annotation.interfaces import IAttributeAnnotatable
    16 # import standard library
    16 from zope.interface import Attribute, Interface, Invalid, implementer, invariant
    17 
    17 from zope.interface.interfaces import IObjectEvent, ObjectEvent
    18 # import interfaces
    18 from zope.lifecycleevent import ObjectCreatedEvent
       
    19 from zope.lifecycleevent.interfaces import IObjectCreatedEvent
       
    20 from zope.schema import Bool, Choice, Datetime, Int, List, Object, Set, Text, TextLine
       
    21 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
       
    22 
       
    23 from pyams_security.schema import Principal
    19 from pyams_utils.interfaces import VIEW_PERMISSION
    24 from pyams_utils.interfaces import VIEW_PERMISSION
    20 from zope.annotation.interfaces import IAttributeAnnotatable
       
    21 from zope.interface.interfaces import IObjectEvent, ObjectEvent
       
    22 from zope.lifecycleevent.interfaces import IObjectCreatedEvent
       
    23 
       
    24 # import packages
       
    25 from pyams_security.schema import Principal
       
    26 from zope.interface import implementer, invariant, Interface, Attribute, Invalid
       
    27 from zope.lifecycleevent import ObjectCreatedEvent
       
    28 from zope.schema import Choice, Datetime, Set, TextLine, Text, List, Object, Int, Bool
       
    29 from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
       
    30 
    25 
    31 from pyams_workflow import _
    26 from pyams_workflow import _
    32 
    27 
    33 
    28 
    34 MANUAL = 0
    29 MANUAL = 0
   199 
   194 
   200     def get_transition_by_id(self, transition_id):
   195     def get_transition_by_id(self, transition_id):
   201         """Get transition with transition_id"""
   196         """Get transition with transition_id"""
   202 
   197 
   203 
   198 
       
   199 WORKFLOWS_VOCABULARY = 'PyAMS workflows'
       
   200 
       
   201 
   204 class IWorkflowInfo(Interface):
   202 class IWorkflowInfo(Interface):
   205     """Get workflow info about workflowed object, and drive workflow.
   203     """Get workflow info about workflowed object, and drive workflow.
   206 
   204 
   207     Defined as an adapter.
   205     Defined as an adapter.
   208     """
   206     """
   371     content_class = Attribute("Content class")
   369     content_class = Attribute("Content class")
   372 
   370 
   373     workflow_name = Choice(title=_("Workflow name"),
   371     workflow_name = Choice(title=_("Workflow name"),
   374                            description=_("Name of workflow utility managing this content"),
   372                            description=_("Name of workflow utility managing this content"),
   375                            required=True,
   373                            required=True,
   376                            vocabulary='PyAMS workflows')
   374                            vocabulary=WORKFLOWS_VOCABULARY)
   377 
   375 
   378     view_permission = Choice(title=_("View permission"),
   376     view_permission = Choice(title=_("View permission"),
   379                              description=_("This permission will be required to display content"),
   377                              description=_("This permission will be required to display content"),
   380                              vocabulary='PyAMS permissions',
   378                              vocabulary='PyAMS permissions',
   381                              default=VIEW_PERMISSION,
   379                              default=VIEW_PERMISSION,