reviewboard.hostingsvcs.base.registry¶
Registry for managing available hosting services.
New in version 6.0: This replaces the registry code in the old
reviewboard.hostingsvcs.service
module.
- class HostingServiceRegistry[source]¶
Bases:
EntryPointRegistry
[Type
[BaseHostingService
]]A registry for managing hosting services.
Changed in version 6.0:
- lookup_attrs: Sequence[str] = ['hosting_service_id'][source]¶
A list of attributes that items can be looked up by.
- errors: RegistryErrorsDict = {'already_registered': '"%(item)s" is already a registered hosting service.', 'load_entry_point': 'Unable to load repository hosting service %(entry_point)s: %(error)s.', 'not_registered': '"%(attr_value)s" is not a registered hosting service.'}[source]¶
Error formatting strings for exceptions.
Entries here override the global
DEFAULT_ERRORS
dictionary for error messages.- Type:
- get_defaults() Iterator[Type[BaseHostingService]] [source]¶
Yield the built-in hosting services.
This will make sure the standard hosting services are always present in the registry.
- Yields:
type
– TheBaseHostingService
subclasses.
- get_hosting_service(hosting_service_id: str) Optional[Type[BaseHostingService]] [source]¶
Return a hosting service with the given ID.
- unregister(service: Type[BaseHostingService]) None [source]¶
Unregister a hosting service.
This will also remove all registered URLs that the hosting service has defined.
- Parameters:
service (
type
) – TheBaseHostingService
subclass.
- unregister_by_id(hosting_service_id: str) None [source]¶
Unregister a hosting service by ID.
This will also remove all registered URLs that the hosting service has defined.
- Parameters:
service (
type
) – TheBaseHostingService
subclass.
- process_value_from_entry_point(entry_point) Type[BaseHostingService] [source]¶
Load the class from the entry point.
The
hosting_service_id
attribute will be set on the class from the entry point’s name.- Parameters:
entry_point (
importlib.metadata.EntryPoint
) – The entry point.- Returns:
The
HostingService
subclass.- Return type:
- register(service: Type[BaseHostingService]) None [source]¶
Register a hosting service.
This also adds the URL patterns defined by the hosting service. If the hosting service has a
HostingService.repository_url_patterns
attribute that is non-None
, they will be automatically added.- Parameters:
service (
type
) – TheHostingService
subclass.
- __annotations__ = {'_items': 'Set[RegistryItemType]', '_populated': 'bool', '_registry': 'Dict[str, Dict[object, RegistryItemType]]', '_url_patterns': 'Dict[str, Sequence[_AnyURL]]', 'already_registered_error_class': 'Type[AlreadyRegisteredError]', 'default_errors': 'RegistryErrorsDict', 'entry_point': 'Optional[str]', 'errors': 'RegistryErrorsDict', 'item_name': 'Optional[str]', 'lookup_attrs': 'Sequence[str]', 'lookup_error_class': 'Type[ItemLookupError]'}¶
- __orig_bases__ = (reviewboard.registries.registry.EntryPointRegistry[typing.Type[reviewboard.hostingsvcs.base.hosting_service.BaseHostingService]],)¶
- __parameters__ = ()¶