dip.settings.default_settings_manager

The dip.settings.default_settings_manager module contains dip’s default settings manager implementation.

SettingsManager

class dip.settings.default_settings_manager.SettingsManager

Base class: Model

The SettingsManager class is the default implementation of the ISettingsManager interface.

load(organization, application=None)

Load the application’s settings.

Parameters:
  • organization – is the name of the organization. It is recommended that this is a FQDN.
  • application – is the name of the application. It will default to the base name of sys.argv[0] with any extension removed.
read_value(name)

Read the value of a setting.

Parameters:name – is the name of the setting.
Returns:the value of the setting, or None if there is no such setting.
restore(models)

Restore the settings for a sequence of models. If no settings have been loaded, i.e. load() has not been called, then this has no effect.

Parameters:models – is the sequence of models. Any model that does not implement ISettings is ignored.
save(models)

Save the settings for a sequence of models. If no settings have been loaded, i.e. load() has not been called, then this has no effect.

Parameters:models – is the sequence of models. Any model that does not implement ISettings is ignored.
write_value(name, value)

Write the value of a setting.

Parameters:
  • name – is the name of the setting.
  • value – is the value of the setting. If this is None then the setting is removed.