The get_workflow API is the primary API:
Workflow objects returned by get_workflow implement the following interface:
- Method: state_info(content, request, context=None, from_state=None)
- Return a sequence of state info dictionaries
- Method: reset(content)
- Reset the object by calling the callback of it’s current state and setting its state attr. If content has no current state, it will be initialized into the initial state for this workflow (see initialize). Return a tuple of (state, msg)
- Method: has_state(content)
- Return true if the content has any state, false if not.
- Method: add_state(name, callback=None, **kw)
- Add a new state. callback is a callback that will be called when a piece of content enters this state.
- Method: transition(content, request, transition_name, context=None, guards=())
- Execute a transition using a transition name.
- Method: state_of(content)
- Return the current state of the content object content or None if the content object has not particpated yet in this workflow.
- Method: get_transitions(content, request, context=None, from_state=None)
- Return a sequence of transition dictionaries
- Method: initialize(content)
- Initialize the content object to the initial state of this workflow. Return a tuple of (state, msg)
- Method: transition_to_state(content, request, to_state, context=None, guards=(), skip_same=True)
- Execute a transition to another state using a state name (to_state). If skip_same is True, and the to_state is the same as the content state, do nothing.
- Method: add_transition(name, from_state, to_state, callback=None, **kw)
- Add a new transition. callback is the callback that will be called when this transition is made (before it enters the next state).
- Method: check()
- Check the consistency of the workflow state machine. Raise an error if it’s inconsistent.
The single exception defined as an API by repoze.workflow is: