collective.multiworkflow.declaration

collective.multiworkflow.declaration#

Registration API for workflow contributions.

A behavior declares the workflows it contributes by registering a subscription adapter on its own marker interface. This module provides the helper used to write such a factory, and the lookup that collects every contribution an object makes.

collective.multiworkflow.declaration.collect_contributions(context: Any) tuple[str, ...][source]#

Collect the workflow ids every participating marker contributes.

Contributions are returned in subscriber registration order, deduplicated, keeping the first occurrence of each id.

Parameters:

context -- the content object whose contributions are collected.

Returns:

the contributed workflow ids, deduplicated and ordered.

collective.multiworkflow.declaration.contributes(marker: type[<InterfaceClass zope.interface.Interface>], *workflow_ids: str) Callable[[Any], tuple[str, ...]][source]#

Build a subscription adapter factory contributing workflow_ids.

Most callers want the ZCML directive instead, which wraps this and validates the marker while the configuration is read:

<plone:additionalworkflows
    marker=".interfaces.IFoundationMember"
    workflows="foundation_member_workflow"
    />

This function stays public for the cases ZCML cannot express — building a contribution from configuration read at start-up, say — where the factory is registered by hand and provides IAdditionalWorkflowsFor.

Parameters:
  • marker -- the behavior marker interface the factory adapts.

  • workflow_ids -- ids of the workflows this marker contributes.

Returns:

an adapter factory returning workflow_ids.