API Documentation for repoze.workflow

repoze.workflow

The get_workflow API is the primary API:

repoze.workflow.get_workflow(content_type, type, context=None)
Return a workflow based on a content_type, the workflow type, and (optionally) a context. The context is used as an argument to electors for placeful workflows.

Workflow objects returned by get_workflow implement the following interface:

Interface: repoze.workflow.interfaces.IWorkflow

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:

class repoze.workflow.WorkflowError

Table Of Contents

Previous topic

Using Configured Workflows

Next topic

Glossary

This Page