Jump to >

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


Registry for managing feature registrations.

class FeaturesRegistry[source]

Bases: djblets.registries.registry.Registry

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.

lookup_attrs = (u'feature_id',)[source]
default_errors = {u'already_registered': u'Could not register feature %(item)s: This feature is already registered or its ID conflicts with another feature.', u'attribute_registered': u'Could not register feature %(item)s: Another feature (%(duplicate)s) is already registered with the same feature ID.', u'invalid_attribute': u'"%(attr_name)s" is not a registered lookup attribute.', u'load_entry_point': u'Could not load entry point %(entry_point)s: %(error)s.', u'missing_attribute': u'Could not register %(item)s: it does not have a "%(attr_name)s" attribute.', u'not_registered': u'No item registered with %(attr_name)s = %(attr_value)s.', u'unregister': u'Could not unregister feature %(item)s: This feature was not yet registered.'}[source]

alias of djblets.features.errors.FeatureConflictError


alias of djblets.features.errors.FeatureNotFoundError


Register a feature instance.

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


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


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.

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

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