# HG changeset patch # User Thierry Florac # Date 1432118627 -7200 # Node ID 08e003da5f9e45bbd4408a02aba0921ac37e94f0 # Parent 709aec8884633d78114f09d37da2e792bff6553b Added workflows vocabulary diff -r 709aec888463 -r 08e003da5f9e src/pyams_workflow/workflow.py --- a/src/pyams_workflow/workflow.py Wed Mar 18 10:10:59 2015 +0100 +++ b/src/pyams_workflow/workflow.py Wed May 20 12:43:47 2015 +0200 @@ -27,8 +27,10 @@ from pyams_utils.traversing import get_parent from pyramid.httpexceptions import HTTPUnauthorized from pyramid.threadlocal import get_current_registry +from zope.componentvocabulary.vocabulary import UtilityVocabulary from zope.interface import implementer from zope.lifecycleevent import ObjectModifiedEvent +from zope.schema.vocabulary import getVocabularyRegistry def NullCondition(wf, context): @@ -247,3 +249,12 @@ # now filter these transitions to retrieve all possible # transitions in this context, and return their ids return [transition for transition in transitions if transition.trigger == trigger] + + +class WorkflowsVocabulary(UtilityVocabulary): + """Workflows vocabulary""" + + interface = IWorkflow + nameOnly = True + +getVocabularyRegistry().register('PyAMS workflows', WorkflowsVocabulary)