collective.multiworkflow.querystring.query_index_modifiers

collective.multiworkflow.querystring.query_index_modifiers#

Redirect review_state collection queries that name a workflow onto the chain index.

A query is moved only when one of its values is qualified. review_state is still a catalog index of its own, maintained by whichever workflow drives each object's review_state, so a criterion written before this add-on was installed — carrying a bare published — is left on it and answers exactly as it always did. The collection editor offers only qualified values, so a criterion saved from it targets workflow_states from then on.

collective.multiworkflow.querystring.query_index_modifiers.REVIEW_STATE = 'review_state'#

The stock catalog index the modifier is registered for.

class collective.multiworkflow.querystring.query_index_modifiers.ReviewStateModifier[source]#

Move a parsed review_state query that names a workflow onto workflow_states.

collective.multiworkflow.querystring.query_index_modifiers.VALUE_KEYS = ('query', 'not')#

The keys of a parsed query whose contents are state values.

collective.multiworkflow.querystring.query_index_modifiers.qualify(state: str) → str[source]#

Name the workflow a bare state id belongs to.

Values in the index read <workflow-id>|<state-id>, so a bare published matches nothing there. ReviewStateModifier needs this only for a query mixing bare and qualified values, which it has to move as a whole: the catalog intersects the results of different indexes, so splitting the values between review_state and workflow_states would turn an any of into an all of.

So a bare id is read as belonging to the site's default workflow, which is the same workflow the index always lists first.

Parameters:

state -- a state id, qualified or not.

Returns:

the value as the index holds it; unchanged when it was already qualified, or when the site declares no default chain to attribute it to.