Jump to >

This documentation covers Djblets 2.x. You can see the latest Djblets documentation or all other versions.

djblets.registries.importer

Import utilities for registries.

lazy_import_registry(module_path, registry_name, **kwargs)[source]

Lazily import and construct a registry on access.

This is useful for providing registry instances in a Django app’s __init__.py file without needing to import other modules that might interfere with the Django initialization process. When accessed for the first time, the registry will be imported and constructed.

This can also speed up the startup process, depending on the complexity of registries.

Parameters
  • module_path (str) – The import path of the module containing the registry.

  • registry_name (str) – The class name of the registry.

  • **kwargs (dict) – Keyword arguments to pass to the registry’s constructor.

Returns

A wrapper that will dynamically load and forward on to the registry.

Return type

djblets.util.compat.django.utils.functional.SimpleLazyObject