djblets.privacy.consent.registry¶
Registry for things that require consent from a user.
- class ConsentRequirementsRegistry¶
Bases:
OrderedRegistry
A registry for managing aspects of a product requiring consent.
Each requirement in the registry requires consent by the user before the action or processing for that requirement is allowed to occur.
- lookup_attrs: Sequence[str] = ('requirement_id',)¶
A list of attributes that items can be looked up by.
- already_registered_error_class¶
alias of
ConsentRequirementConflictError
- lookup_error_class¶
alias of
ConsentRequirementNotFoundError
- default_errors: RegistryErrorsDict = {'already_registered': 'Could not register consent requirement %(item)s: This requirement is already registered or its ID conflicts with another consent requirement.', 'attribute_registered': 'Could not register consent requirement %(item)s: Another requirement (%(duplicate)s) is already registered with the same ID.', 'invalid_attribute': '"%(attr_name)s" is not a registered lookup attribute.', 'load_entry_point': 'Could not load entry point %(entry_point)s: %(error)s.', 'missing_attribute': 'Could not register %(item)s: it does not have a "%(attr_name)s" attribute.', 'not_registered': 'No item registered with %(attr_name)s = %(attr_value)s.', 'unregister': 'Could not unregister consent requirement %(item)s: This requirement was not yet registered.'}¶
The default error formatting strings.
If subclasses need to provide additional errors that can be overridden, they should copy
DEFAULT_ERRORS
and set their copy on the subclass as this attribute.- Type:
- get_consent_requirement(requirement_id)¶
Return a consent requirement with the given ID.
- Parameters:
requirement_id (
unicode
) – The consent requirement ID to look up.- Returns:
The resulting consent requirement, if found. If a requirement with this ID could not be found, this will return
None
.- Return type:
- __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'}¶
- __parameters__ = ()¶
- get_consent_requirements_registry()¶
Return the registry for managing consent requirements.
- Returns:
The registry for consent requirements.
- Return type: