Document workflows

Coaster provides versions of the main Docflow classes where workflow exceptions map to HTTP 403 Forbidden (via werkzeug.exceptions.Forbidden).

exception coaster.docflow.WorkflowStateException(description=None, response=None)[source]
exception coaster.docflow.WorkflowTransitionException(description=None, response=None)[source]
exception coaster.docflow.WorkflowPermissionException(description=None, response=None)[source]
class coaster.docflow.WorkflowState(value, title=u'', description=u'')[source]

State in a workflow.

exception_permission

alias of WorkflowPermissionException

exception_state

alias of WorkflowStateException

exception_transition

alias of WorkflowTransitionException

class coaster.docflow.WorkflowStateGroup(value, title=u'', description=u'')[source]

Group of states in a workflow. The value parameter is a list of values or WorklowState instances.

exception_permission

alias of WorkflowPermissionException

exception_state

alias of WorkflowStateException

exception_transition

alias of WorkflowTransitionException

class coaster.docflow.InteractiveTransition(workflow)[source]

Multipart workflow transitions. Subclasses of this class may provide methods to return a form, validate the form and submit the form. Implementing a submit() method is mandatory. submit() will be wrapped by the transition() decorator to automatically update the document’s state value.

Instances of InteractiveTransition will receive workflow and document attributes pointing to the workflow instance and document respectively.

validate()[source]

Validate self.form, assuming Flask-WTF Form

class coaster.docflow.DocumentWorkflow(document, context=None)[source]

Base class for document workflows.

exception_state

alias of WorkflowStateException

permissions()[source]

Permissions for this workflow. Plays nice with coaster.views.load_models() and coaster.sqlalchemy.PermissionMixin to determine the available permissions to the current user.