API
Actions and Flow Control
flowcontrol.base.FlowDirective
FlowDirective.CONTINUE: Run the next action in the sequence.FlowDirective.ENTER: Run the sub-actions of the current action.FlowDirective.LEAVE: Run the parent action again (likecontinuein a loop)FlowDirective.BREAK: Run the parent action's next sibling (likebreakin a loop).FlowDirective.ABORT: Stop the flow run.FlowDirective.SUSPEND: Pause the execution of the flow run and continue with the action's next sibling at the time of the run'scontinue_afterfield.FlowDirective.SUSPEND_AND_REPEAT: Pause the execution of the flow run and re-run the action at the time of the run'scontinue_afterfield.
flowcontrol.base.BaseAction
Inherit from this for your own actions:
get_context()
Get the context for the action. This method can be overridden in subclasses to provide additional context.
| Returns: |
|
|---|
get_name()
classmethod
Get the name of the action, uses the class name by default.
return_from_children(*, run, obj=None, config=None)
This is run when returning from child actions to a parent action.
| Parameters: |
|
|---|
| Returns: |
|
|---|
run(*, run, obj=None, config=None)
Run the action and return a flow directive This method should be overridden in subclasses.
| Parameters: |
|
|---|
| Returns: |
|
|---|
flowcontrol.registry.register_action
Decorator to register an action class.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Flow Triggers
The function to register a trigger returns a function that can be called to start the associated flows. It's optional to use these functions, you can also call the flowcontrol.engine.trigger_flows directly.
flowcontrol.registry.register_trigger
Register the trigger name
| Parameters: |
|
|---|
| Returns: |
|
|---|
flowcontrol.registry.register_trigger_as_signal_handler
Register a trigger and return a Django signal handler function.
This is a shortcut to register a trigger and returns a function that can be used as a signal handler.
Example:
post_save.connect(register_trigger_as_signal_handler("mymodel_postsave"))
| Parameters: |
|
|---|
| Returns: |
|
|---|
flowcontrol.engine.trigger_flows
Triggers flows based on the given trigger name.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Flow Control Engine
flowcontrol.engine.create_flowrun
Creates a new flow run from flow when limits allow it.
| Parameters: |
|
|---|
| Returns: |
|
|---|
flowcontrol.engine.start_flowrun
Creates a flow run (flow limits allowing) and executes it immediately.
| Parameters: |
|
|---|
| Returns: |
|
|---|
flowcontrol.engine.execute_flowrun
Executes the flow run, processing its actions.
| Parameters: |
|
|---|
| Returns: |
|
|---|