djblets.pagestate.injectors¶
Injectors for page state.
New in version 6.0.
- class PageStateInjectorProtocol(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol describing page state injectors.
Classes implementing this protocol can dynamically provide data for page state. They must be registered with
page_state_injectors.New in version 6.0.
- iter_page_state_data(*, point_name: str, request: HttpRequest, context: Context) Iterator[PageStateData][source]¶
Generate page state data.
Implementations may yield zero or more
PageStateDatafor a given page hook point name. These will be made available in the page.- Parameters:
point_name (
str) – The page hook point name to populate.request (
django.http.HttpRequest) – The HTTP request from the client.context (
django.template.Context) – The context for the templates.
- Yields:
djblets.pagestate.state.PageStateData– Data for provide for the page hook point.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'injector_id': 'str'}¶
- __init__(*args, **kwargs)¶
- __parameters__ = ()¶
- __subclasshook__()¶
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- class PageStateInjectorRegistry[source]¶
Bases:
OrderedRegistry[PageStateInjectorProtocol]A registry for managing page state injectors.
New in version 6.0.
- lookup_attrs: Sequence[str] = ('injector_id',)[source]¶
A list of attributes that items can be looked up by.
- __annotations__ = {'_by_id': 'Dict[int, RegistryItemType]', '_items': 'set[RegistryItemType]', '_key_order': 'List[int]', '_lock': 'RLock', '_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]', 'state': 'RegistryState'}¶
- __orig_bases__ = (djblets.registries.registry.OrderedRegistry[djblets.pagestate.injectors.PageStateInjectorProtocol],)¶
- __parameters__ = ()¶