Skip to content

angee.base.registry

Resolve a registry key against a settings-backed key→dotted-path mapping.

The one owner of "turn a short key into its implementation class" — the rule both :class:~angee.base.fields.ImplClassField (a per-row column) and the row-less per-deployment selectors (the platform AddonInstaller backend) share. A key is looked up in a Django setting mapping keys to dotted import paths, import_string-ed from the composed, trusted settings (never row text), and checked against a base class. Keeping the rule here means a single resolution/validation shape across every registry-backed selector instead of a copy per call site.

impl_registry

python
def impl_registry(registry_setting: str) -> dict[str, str]

Return the configured key → dotted path mapping for registry_setting.

Reads the named Django setting and coerces it to str → str. Raises ImproperlyConfigured when the setting is present but not a mapping.

resolve_impl_class

python
def resolve_impl_class(registry_setting: str, key: str,
                       base_class: type) -> type

Return the impl class registry_setting binds to key (a base_class subclass).

Resolves the composed, trusted dotted path (never row text) and verifies the import is a base_class subclass, raising ImproperlyConfigured with the known keys on a miss and naming the offending path on a type mismatch.

Released under the AGPL-3.0 License.