Cheetah.SettingsManager module

class Cheetah.SettingsManager.ConfigParserCaseSensitive(defaults=None, dict_type=<class 'collections.OrderedDict'>, allow_no_value=False, *, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section='DEFAULT', interpolation=<object object>)

Bases: configparser.ConfigParser

A case sensitive version of the standard Python ConfigParser.


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

exception Cheetah.SettingsManager.Error

Bases: 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.


Returns a shallow copy of the settings dictionary


Returns a deep copy of the settings dictionary



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.


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.


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.


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