Jump to >

This documentation covers the in-development release of Djblets. You can see the latest stable docs or all previous versions.

djblets.features.registry

Registry for managing feature registrations.

class FeaturesRegistry[source]

A registry for instantiated features.

This manages all instances of Feature subclasses that the product has created, providing easy access to features for checking purposes.

already_registered_error_class[source]

alias of djblets.features.errors.FeatureConflictError

lookup_error_class[source]

alias of djblets.features.errors.FeatureNotFoundError

register(feature)[source]

Register a feature instance.

The feature’s initialize() method will be called once registered.

Parameters

feature (djblets.features.feature.Feature) – The feature to register.

Raises
unregister(feature)[source]

Unregister a feature instance.

The feature’s shutdown() method will be called once unregistered.

Parameters

feature (djblets.features.feature.Feature) – The feature to unregister.

Raises

djblets.features.errors.FeatureNotFoundError – Raised if the feature was not already registered.

get_feature(feature_id)[source]

Return the feature instance with the given ID.

Parameters

feature_id (unicode) – The ID of the feature to return.

Returns

The feature instance matching the ID or None if not found.

Return type

djblets.features.feature.Feature

get_features_registry()[source]

Return the global features registry.

The first time this is called, a FeaturesRegistry will be instantiated and cached for future calls.

Returns

The features registry.

Return type

FeaturesRegistry