Cheetah.SettingsManager module

class Cheetah.SettingsManager.ConfigParserCaseSensitive(defaults=None, dict_type=<class 'collections.OrderedDict'>, allow_no_value=False)

Bases: ConfigParser.ConfigParser

A case sensitive version of the standard Python ConfigParser.

optionxform(optionstr)

Don’t change the case as is done in the default implemenation.

exception Cheetah.SettingsManager.Error

Bases: exceptions.Exception

class Cheetah.SettingsManager.NoDefault

Bases: object

class Cheetah.SettingsManager.SettingsManager

Bases: Cheetah.SettingsManager._SettingsCollector

A mixin class that provides facilities for managing application settings.

SettingsManager is designed to work well with nested settings dictionaries of any depth.

copySettings()

Returns a shallow copy of the settings dictionary

deepcopySettings()

Returns a deep copy of the settings dictionary

hasSetting(key)

True/False

setSetting(name, value)

Set a setting in self._settings.

setting(name, default=<class 'Cheetah.SettingsManager.NoDefault'>)

Get a setting from self._settings, with or without a default value

settings()

Return a reference to the settings dictionary

updateSettings(newSettings, merge=True)

Update the settings with a selective merge or a complete overwrite

updateSettingsFromConfigFileObj(inFile, convert=True, merge=True)

See the docstring for .updateSettingsFromConfigFile()

The caller of this method is responsible for closing the inFile file object.

updateSettingsFromConfigStr(configStr, convert=True, merge=True)

See the docstring for .updateSettingsFromConfigFile()

updateSettingsFromPySrcStr(theString, merge=True)

Update the settings from a code in a Python src string.

Cheetah.SettingsManager.convStringToNum(theString)

Convert a string representation of a Python number to the Python version

Cheetah.SettingsManager.mergeNestedDictionaries(dict1, dict2, copy=False, deepcopy=False)

Recursively merge the values of dict2 into dict1.

This little function is very handy for selectively overriding settings in a settings dictionary that has a nested structure.

Cheetah.SettingsManager.stringIsNumber(S)

Return True if theString represents a Python number, False otherwise. This also works for complex numbers and numbers with +/- in front.