reviewboard.actions.registry¶
Registry for actions.
New in version 6.0.
- class ActionsRegistry[source]¶
Bases:
OrderedRegistry
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_ERRORS
dictionary for error messages.- Type:
- get_defaults() Iterator[BaseAction] [source]¶
Yield the built-in actions.
- Yields:
reviewboard.actions.base.BaseAction
– The built-in actions.
- register(action: BaseAction) None [source]¶
Register an item.
- Parameters:
action (
reviewboard.actions.base.BaseAction
) – The action to register.- Raises:
djblets.registries.errors.AlreadyRegisteredError – The item is already registered or if the item shares an attribute name, attribute value pair with another item in the registry.
djblets.registries.errors.RegistrationError – The item is missing one of the required attributes.
reviewboard.actions.errors.DepthLimitExceededError – The action was nested too deeply.
- unregister(action: BaseAction) None [source]¶
Unregister an item.
- Parameters:
action (
reviewboard.actions.base.BaseAction
) – The action to unregister.- Raises:
djblets.registries.errors.ItemLookupError – Raised if the item is not found in the registry.
- 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.
- __annotations__ = {'_by_id': 'Dict[int, RegistryItemType]', '_deferred_registrations': 'List[BaseAction]', '_items': 'Set[RegistryItemType]', '_key_order': 'List[int]', '_populated': 'bool', '_registry': 'Dict[str, Dict[object, RegistryItemType]]', 'already_registered_error_class': 'Type[AlreadyRegisteredError]', 'default_errors': 'RegistryErrorsDict', 'errors': 'RegistryErrorsDict', 'item_name': 'Optional[str]', 'lookup_attrs': 'Sequence[str]', 'lookup_error_class': 'Type[ItemLookupError]'}¶
- __parameters__ = ()¶