reviewboard.actions.registry¶
Registry for actions.
New in version 6.0.
- class ActionAttachmentPointsRegistry[source]¶
Bases:
Registry[ActionAttachmentPoint]A registry for action attachment points.
New in version 7.1.
- lookup_attrs: Sequence[str] = ['attachment_point_id'][source]¶
A list of attributes that items can be looked up by.
- errors: RegistryErrorsDict = {'already_registered': '"%(item)s" is already a registered attachment point.', 'not_registered': '"%(attr_value)s" is not a registered attachment point.'}[source]¶
Error formatting strings for exceptions.
Entries here override the global
DEFAULT_ERRORSdictionary for error messages.- Type:
- get_defaults() Iterator[ActionAttachmentPoint][source]¶
Yield the built-in attachment points.
- Yields:
reviewboard.actions.base.BaseAction– The built-in attachment points.
- get_attachment_point(attachment_point_id: str) reviewboard.actions.base.ActionAttachmentPoint | None[source]¶
Return the attachment point with the given ID.
- Parameters:
attachment_point_id (
str) – The attachment point ID to look up.- Returns:
The resulting attachment point instance, or
Noneif not found.- Return type:
- class ActionsRegistry[source]¶
Bases:
OrderedRegistry[BaseAction]A registry for actions.
New in version 6.0.
- lookup_attrs: Sequence[str] = ['action_id'][source]¶
A list of attributes that items can be looked up by.
- errors: RegistryErrorsDict = {'already_registered': '"%(item)s" is already a registered action.', 'not_registered': '"%(attr_value)s" is not a registered action.'}[source]¶
Error formatting strings for exceptions.
Entries here override the global
DEFAULT_ERRORSdictionary for error messages.- Type:
- get_defaults() Iterator[BaseAction][source]¶
Yield the built-in actions.
- Yields:
reviewboard.actions.base.BaseAction– The built-in actions.
- on_reset() None[source]¶
Handle cleanup after resetting the registry.
This clears cached state used for looking up actions by attachment point and deferred placements.
- on_item_registered(action: BaseAction, /) None[source]¶
Handle post-registration placement of an action.
This will process any placements for the action, putting them in the right place within an attachment point’s action hierarchy.
It will also handle deferring any placements for parent actions not yet registered, and processing of deferred placements for actions now registered.
- Parameters:
action (
reviewboard.actions.base.BaseAction) – The action that was registered.
- on_item_unregistering(action: BaseAction, /) None[source]¶
Handle pre-unregistration tasks for an action.
- Parameters:
action (
reviewboard.actions.base.BaseAction) – The action to unregister.
- get_action(action_id: str) reviewboard.actions.base.BaseAction | None[source]¶
Return the action with the given ID.
New in version 7.1.
- Parameters:
action_id (
str) – The action ID to look up.- Returns:
The resulting action instance, or
Noneif not found.- Return type:
- get_for_attachment(attachment: str, *, include_children: bool = False) Iterator[BaseAction][source]¶
Yield actions for the given attachment point.
- Parameters:
attachment (
reviewboard.actions.base.AttachmentPoint) – The attachment point.include_children (
bool, optional) – Whether to also include children of menus. IfFalse, this will only yield the top-level items.
- Yields:
reviewboard.actions.base.BaseAction– The actions for the given attachment point.
- get_children(parent_id: str) Iterator[BaseAction][source]¶
Return the children for a menu action.
- Parameters:
parent_id (
str) – The ID of the parent.- Yields:
reviewboard.actions.base.BaseAction– The actions that are contained within the menu.