config - System wide configuration

CSTBox system wide configuration routines and definitions.

This implementation is based on INI like configuration files.

pycstbox.config.make_config_file_path(filename)

Returns the full path of a configuration file located in CSTBox default configuration directory.

class pycstbox.config.GlobalSettings(path=None)

A special pre-defined configuration file containing application wide parameters.

The file name is pre-defined, and data are automatically loaded when creating the instance, thus relieving from explicitly call the read() method.

In addition, since this file is single section, simplified get/set methods are proposed, removing the need to specify a section name.

Some fixed settings are also provided as class attributes.

Parameters:path (str) – configuration file path, used only for unit tests
get(option)

Overridden ConfigParser.SafeConfigParser.get() hiding parameters having no use in this version for simplication’s sake.

set(option, value)

Overridden ConfigParser.SafeConfigParser.set() hiding parameters having no use in this version for simplication’s sake.

write()

Overridden ConfigParser.SafeConfigParser.write() hiding parameters having no use in this version since storage file is defined at instanciation time (see constructor).

as_dict()

Returns the configuration content as a dictionary.