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_ERRORSdictionary 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– TheBaseHostingServicesubclasses.
- 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) – TheBaseHostingServicesubclass.
- 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) – TheBaseHostingServicesubclass.
- process_value_from_entry_point(entry_point) Type[BaseHostingService][source]¶
Load the class from the entry point.
The
hosting_service_idattribute will be set on the class from the entry point’s name.- Parameters:
entry_point (
importlib.metadata.EntryPoint) – The entry point.- Returns:
The
HostingServicesubclass.- 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_patternsattribute that is non-None, they will be automatically added.- Parameters:
service (
type) – TheHostingServicesubclass.