10 # FOR A PARTICULAR PURPOSE. |
10 # FOR A PARTICULAR PURPOSE. |
11 # |
11 # |
12 |
12 |
13 __docformat__ = 'restructuredtext' |
13 __docformat__ = 'restructuredtext' |
14 |
14 |
15 |
|
16 # import standard library |
|
17 |
|
18 # import interfaces |
|
19 from pyams_workflow.interfaces import MANUAL, SYSTEM, AUTOMATIC, IWorkflow, InvalidTransitionError, IWorkflowState, \ |
|
20 IWorkflowVersions, IWorkflowVersion, IWorkflowInfo, IWorkflowManagedContent, WorkflowVersionTransitionEvent, \ |
|
21 WorkflowTransitionEvent, ConditionFailedError, NoTransitionAvailableError, AmbiguousTransitionError |
|
22 |
|
23 # import packages |
|
24 from pyams_utils.adapter import adapter_config |
|
25 from pyams_utils.registry import get_utility, get_global_registry |
|
26 from pyams_utils.request import check_request, query_request |
|
27 from pyams_utils.traversing import get_parent |
|
28 from pyams_utils.vocabulary import vocabulary_config |
|
29 from pyramid.httpexceptions import HTTPUnauthorized |
15 from pyramid.httpexceptions import HTTPUnauthorized |
30 from zope.componentvocabulary.vocabulary import UtilityVocabulary |
16 from zope.componentvocabulary.vocabulary import UtilityVocabulary |
31 from zope.interface import implementer |
17 from zope.interface import implementer |
32 from zope.lifecycleevent import ObjectModifiedEvent |
18 from zope.lifecycleevent import ObjectModifiedEvent |
|
19 |
|
20 from pyams_utils.adapter import adapter_config |
|
21 from pyams_utils.registry import get_global_registry, get_utility |
|
22 from pyams_utils.request import check_request, query_request |
|
23 from pyams_utils.traversing import get_parent |
|
24 from pyams_utils.vocabulary import vocabulary_config |
|
25 from pyams_workflow.interfaces import AUTOMATIC, AmbiguousTransitionError, ConditionFailedError, IWorkflow, \ |
|
26 IWorkflowInfo, IWorkflowManagedContent, IWorkflowState, IWorkflowVersion, IWorkflowVersions, InvalidTransitionError, \ |
|
27 MANUAL, NoTransitionAvailableError, SYSTEM, WORKFLOWS_VOCABULARY, WorkflowTransitionEvent, \ |
|
28 WorkflowVersionTransitionEvent |
33 |
29 |
34 from pyams_workflow import _ |
30 from pyams_workflow import _ |
35 |
31 |
36 |
32 |
37 def NullCondition(wf, context): |
33 def NullCondition(wf, context): |
280 # now filter these transitions to retrieve all possible |
276 # now filter these transitions to retrieve all possible |
281 # transitions in this context, and return their ids |
277 # transitions in this context, and return their ids |
282 return [transition for transition in transitions if transition.trigger == trigger] |
278 return [transition for transition in transitions if transition.trigger == trigger] |
283 |
279 |
284 |
280 |
285 @vocabulary_config(name='PyAMS workflows') |
281 @vocabulary_config(name=WORKFLOWS_VOCABULARY) |
286 class WorkflowsVocabulary(UtilityVocabulary): |
282 class WorkflowsVocabulary(UtilityVocabulary): |
287 """Workflows vocabulary""" |
283 """Workflows vocabulary""" |
288 |
284 |
289 interface = IWorkflow |
285 interface = IWorkflow |
290 nameOnly = True |
286 nameOnly = True |