[z3-checkins] r17559 - z3/hurry/trunk/src/hurry/workflow
faassen at codespeak.net
faassen at codespeak.net
Wed Sep 14 14:57:28 CEST 2005
Author: faassen
Date: Wed Sep 14 14:57:27 2005
New Revision: 17559
Modified:
z3/hurry/trunk/src/hurry/workflow/interfaces.py
z3/hurry/trunk/src/hurry/workflow/workflow.py
z3/hurry/trunk/src/hurry/workflow/workflow.txt
Log:
Allow getting transitions towards
destination state, instead of possible
transitions for source state.
Modified: z3/hurry/trunk/src/hurry/workflow/interfaces.py
==============================================================================
--- z3/hurry/trunk/src/hurry/workflow/interfaces.py (original)
+++ z3/hurry/trunk/src/hurry/workflow/interfaces.py Wed Sep 14 14:57:27 2005
@@ -114,6 +114,10 @@
These transitions have to have a condition that's True.
"""
+ def getManualTransitionIdsToward(state):
+ """Returns list of manual transitions towards state.
+ """
+
def getAutomaticTransitionIds():
"""Returns list of possible automatic transitions.
Modified: z3/hurry/trunk/src/hurry/workflow/workflow.py
==============================================================================
--- z3/hurry/trunk/src/hurry/workflow/workflow.py (original)
+++ z3/hurry/trunk/src/hurry/workflow/workflow.py Wed Sep 14 14:57:27 2005
@@ -219,6 +219,15 @@
transition.condition(self, self.context) and
checkPermission(transition.permission, self.context)]
+ def getManualTransitionIdsToward(self, state):
+ wf = zapi.getUtility(IWorkflow)
+ result = []
+ for transition_id in self.getManualTransitionIds():
+ transition = wf.getTransitionById(transition_id)
+ if transition.destination == state:
+ result.append(transition_id)
+ return result
+
def getAutomaticTransitionIds(self):
return [transition.transition_id for transition in
self._getTransitions(AUTOMATIC)]
Modified: z3/hurry/trunk/src/hurry/workflow/workflow.txt
==============================================================================
--- z3/hurry/trunk/src/hurry/workflow/workflow.txt (original)
+++ z3/hurry/trunk/src/hurry/workflow/workflow.txt Wed Sep 14 14:57:27 2005
@@ -130,6 +130,12 @@
>>> info.getManualTransitionIds()
['a_to_b']
+We can also get this by asking which manual transition exists that brings
+us to the desired workflow state::
+
+ >>> info.getManualTransitionIdsToward('b')
+ ['a_to_b']
+
Since this is a manually triggered transition, we can fire this
transition::
More information about the z3-checkins
mailing list