14.2 Workflow Aware objects

A Workflow Aware object is one that inherits from the WorkflowAware class:

    from itools.workflow import WorkflowAware

    class Document(WorkflowAware):
        pass

To make use of the workflow system we must initialize our workflow aware objects with a call to enter_workflow; then we will be able to move the object from one state to another with do_trans:

    >>> document = Document()
    >>> document.enter_workflow(workflow)
    >>> document.do_trans('request')
    >>> document.do_trans('accept')
    >>> print document.get_statename()
    public

The method get_statename will return the name of the state the object is in.