collective.multiworkflow.utils.workflow#
The values held by the workflow_states catalog index.
One KeywordIndex describes an object's whole workflow chain, so a site
gains no further indexes as behaviors contribute more workflows. Each entry
reads <workflow-id>|<state-id>, and the entries are in chain order — the
workflow configured for the type, the one driving review_state, is always
first.
The same name is also the state_variable an additional workflow should
adopt, and that is not cosmetic. WorkflowTool._reindexWorkflowVariables
reindexes exactly the indexes named after the chain's workflow variables, so a
workflow using this name keeps the index fresh with no help from us;
reindex_workflow_states()
covers the ones that keep a state variable of their own. Sharing the name
across workflows is safe because DCWorkflow keys its status records by workflow
id, not by variable name.
formatted_workflow_states() is the single source of those values: the
catalog indexer and the REST API content serializer both return it, so the two
cannot disagree.
- collective.multiworkflow.utils.workflow.STATE_SEPARATOR = '|'#
Separates the workflow id from the state id within one indexed value. Neither id can contain it — both are Zope ids.
- collective.multiworkflow.utils.workflow.WORKFLOW_STATES = 'workflow_states'#
Name of the index, of the metadata column, and the
state_variablean additional workflow should adopt.
- collective.multiworkflow.utils.workflow.format_state(workflow_id: str, state_id: str) str[source]#
Build one indexed value out of a workflow id and a state id.
- Parameters:
workflow_id -- id of the workflow the state belongs to.
state_id -- id of the state that workflow is in.
- Returns:
the value as the catalog holds it.
- collective.multiworkflow.utils.workflow.formatted_workflow_states(obj: DexterityContent) tuple[str, ...][source]#
Describe the object's state in every workflow of its chain.
- Parameters:
obj -- the object to describe.
- Returns:
<workflow-id>|<state-id>for each workflow of the chain, in chain order; empty for an object with no workflow at all.
- collective.multiworkflow.utils.workflow.parse_state(value: str) tuple[str, str][source]#
Split one indexed value back into its workflow id and state id.
- Parameters:
value -- a value as
format_state()produced it.- Returns:
the workflow id and the state id.
- Raises:
ValueError -- if the value carries no separator.