djblets.privacy.consent.registry¶
Registry for things that require consent from a user.
- class ConsentRequirementsRegistry[source]¶
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',)[source]¶
A list of attributes that items can be looked up by.
- already_registered_error_class[source]¶
alias of
ConsentRequirementConflictError
- lookup_error_class[source]¶
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.'}[source]¶
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)[source]¶
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]', '_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__ = ()¶