wagtailapproval.signals

This is all the signals supported by wagtailapproval. Examples of most of the important ones can be found directly in wagtailapproval._signals.

Signals are documented here as the functions that catch them. sender, signal, and **kwargs are ommitted for brevity. Some signals expect return values and may misbehave if the signal handlers don’t return what they are expected to.

step_published(instance)

Sent when a step is published.

Parameters:instance (ApprovalStep) – The instance that was published
pipeline_published(instance)

Sent when a pipeline is published.

Parameters:instance (ApprovalPipeline) – The instance that was published
build_approval_item_list(approval_step, user)

Used when building the approval items. Should return an iterable of ApprovalItem instances. You may return any iterable, meaning generators are also acceptable.

Parameters:
  • approval_step (ApprovalStep) – The step to grab items from
  • user (User) – The user to grab items for
Return type:

Iterable[ApprovalItem]

Returns:

An iterable of ApprovalItem instances

remove_approval_items(approval_items, user)

Can be used to implement custom filtering. Should return an iterable of ApprovalItem instances that the user doesn’t want shown. The instances don’t have to exactly match, but may support equality. It is preferable that you use the same object, though, as an is comparison is faster.

Parameters:
  • approval_items (tuple[ApprovalItem]) – The full list of approval items
  • user (User) – The user to filter items for
Return type:

Iterable[ApprovalItem]

Returns:

An iterable of ApprovalItem instances

set_collection_edit(approval_step, edit)

Can be used to customize collection editing permissions. Use the edit kwarg, not the step’s can_edit field, because they might not match.

Parameters:
  • approval_step (ApprovalStep) – The step to modify collection permissions for
  • edit (bool) – whether editing is to be enabled or disabled
take_ownership(approval_step, object, pipeline)

Used for taking ownership by specific type. Do not work with ApprovalTicket here, as it’s done automatically after this signal is called. This is done for permissions management.

Parameters:
  • approval_step (ApprovalStep) – The step to give the object to.
  • object – The object to give to the step
  • pipeline (ApprovalPipeline) – The pipeline for the ApprovalStep
release_ownership(approval_step, object, pipeline)

Used for releasing ownership by specific type. Do not work with ApprovalTicket here, as it’s done automatically after this signal is called. This is used for permissions management.

Parameters:
  • approval_step (ApprovalStep) – The step to give the object to.
  • object – The object to give to the step
  • pipeline (ApprovalPipeline) – The pipeline for the ApprovalStep
pre_transfer_ownership(giving_step, taking_step, object, pipeline)

Sent before transferring ownership. This is done after pre_approve() or pre_reject(). This can be used for validation.

Parameters:
  • giving_step (ApprovalStep) – The step who will be releasing the object
  • taking_step (ApprovalStep) – The step who will be taking the object
  • object – The object to be transferred.
  • pipeline (ApprovalPipeline) – The pipeline for the steps
post_transfer_ownership(giving_step, taking_step, object, pipeline)

Sent after transferring ownership. This is done before post_approve() or post_reject(). This should be used if you want to do something after each transfer.

Parameters:
  • giving_step (ApprovalStep) – The step that has released the object
  • taking_step (ApprovalStep) – The step that has taken the object
  • object – The object that has been transferred
  • pipeline (ApprovalPipeline) – The pipeline for the steps
pre_approve(giving_step, taking_step, object, pipeline)

Sent before approval. This is done before pre_transfer_ownership(). This can be used for validation. If approve is run on an object that has no approval step, this will not be executed.

Parameters:
  • giving_step (ApprovalStep) – The step who will be releasing the object
  • taking_step (ApprovalStep) – The step who will be taking the object
  • object – The object to be transferred.
  • pipeline (ApprovalPipeline) – The pipeline for the steps
post_approve(giving_step, taking_step, object, pipeline)

Sent after approval. This is done after post_transfer_ownership(). This should be used if you want to do something after each transfer (such as if taking_step is a step that is meant to perform some sort of automatic validation or automatic approval/rejection). If approve is run on an object that has no approval step, this will not be executed.

Parameters:
  • giving_step (ApprovalStep) – The step that has released the object
  • taking_step (ApprovalStep) – The step that has taken the object
  • object – The object that has been transferred
  • pipeline (ApprovalPipeline) – The pipeline for the steps
pre_reject(giving_step, taking_step, object, pipeline)

Sent before rejection. This is done before pre_transfer_ownership(). This can be used for validation. If approve is run on an object that has no rejection step, this will not be executed.

Parameters:
  • giving_step (ApprovalStep) – The step who will be releasing the object
  • taking_step (ApprovalStep) – The step who will be taking the object
  • object – The object to be transferred.
  • pipeline (ApprovalPipeline) – The pipeline for the steps
post_reject(giving_step, taking_step, object, pipeline)

Sent after rejection. This is done after post_transfer_ownership(). This should be used if you want to do something after each transfer (such as if taking_step is a step that is meant to perform some sort of automatic validation or automatic approval/rejection). If approve is run on an object that has no rejection step, this will not be executed.

Parameters:
  • giving_step (ApprovalStep) – The step that has released the object
  • taking_step (ApprovalStep) – The step that has taken the object
  • object – The object that has been transferred
  • pipeline (ApprovalPipeline) – The pipeline for the steps