Jump to >


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.


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.


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.


Loads the settings from the database.


Saves all current settings to the database.