Jump to >

djblets.extensions.settings

class Settings(extension)[source]

Bases: dict

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_settings will be checked as well.

__init__(extension)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

__getitem__(key)[source]

Retrieve an item from the dictionary.

This will attempt to return a default value from extension.default_settings if the setting has not been set.

__contains__(key)[source]

Indicate if the setting is present.

If the key is not present in the settings dictionary check the default settings as well.

get(key, default=None)[source]

Returns a setting.

This will return the setting’s stored value, or its default value if unset.

If the key isn’t a valid setting, the provided default will be returned instead.

set(key, value)[source]

Sets a setting’s value.

This is equivalent to setting the value through standard dictionary attribute storage.

load()[source]

Loads the settings from the database.

save()[source]

Saves all current settings to the database.