Settings data for an extension.
This is a glorified dictionary that acts as a proxy for the extension’s stored settings in the database.
Callers must call
save()when they want to make the settings persistent.
If a key is not found in the dictionary,
Extension.default_settingswill be checked as well.
Initialize and load the settings.
Parameters: extension (djblets.extensions.extension.Extension) – The extension the settings is for.
Retrieve an item from the dictionary.
This will attempt to return a default value from
Extension.default_settingsif the setting has not been set.
Parameters: key (unicode) – The key to retrieve. Returns: The value from settings. Return type: object Raises:
KeyError– The key could not be found in stored or default settings.
Return if a setting can be found.
This will check both the stored settings and the default settings for the extension.
Parameters: key (unicode) – The key to check. Returns:
Trueif the setting could be found.
Falseif it could not.
Return type: bool
Return the value for a setting.
This will return a value from either the stored settings, the extensin’s default settings, or the value passed as
- key (unicode) – The key to retrieve.
- default (object, optional) – The default value, if it couldn’t be found in the stored settings or the extension’s default settings.
The value for the setting.
Set a setting’s value.
This is equivalent to setting the value through standard dictionary attribute storage.
- key (unicode) – The key to set.
- value (object) – The value for the setting.
Load the settings from the database.
Save all current settings to the database.
Legacy name for ExtensionSettings.
This is unlikely to be needed outside of the Djblets Extensions code, but is available for any callers who might be dependent on it.
Deprecated since version 2.0: Renamed to
ExtensionSettings. This will be removed in Djblets 3.0.