edx_toggles.toggles.internal package



edx_toggles.toggles.internal.base module

Feature toggle base classes

class edx_toggles.toggles.internal.base.BaseToggle(name, default=False, module_name='')

Bases: ABC

This abstract base class exposes the basic API required by toggle classes. Toggle instances are tracked in the _class_instances class method, which is exposed via the get_instances class method.

classmethod get_instances()

Return the list of class instances sorted by name.

classmethod validate_name(name)

Validate the format of the instance name. This should raise a ValueError in case of incorrect format. This method should only be used by child classes, mostly for overriding purposes.

edx_toggles.toggles.internal.setting_toggle module

Setting-derived feature toggles

class edx_toggles.toggles.internal.setting_toggle.SettingDictToggle(name, key, default=False, module_name='')

Bases: BaseToggle

Feature toggle based on the value of a key in a Django setting dict. Use as follows:

MY_FEATURE = SettingDictToggle(“SETTING_NAME”, “key” default=False, module_name=__name__)

class edx_toggles.toggles.internal.setting_toggle.SettingToggle(name, default=False, module_name='')

Bases: BaseToggle

Feature toggle based on a Django setting value. Use as follows:

MY_FEATURE = SettingToggle(“SETTING_NAME”, default=False, module_name=__name__)


Module contents

This module includes all code related to feature toggles. Remember to import publicly available classes and functions in toggles/__init__.py.