cement.ext.ext_configparser
Cement configparser extension module.
- class cement.ext.ext_configparser.ConfigParserConfigHandler(**kw)[source]
Bases:
ConfigHandler
,RawConfigParser
This class is an implementation of the Config interface. It handles configuration file parsing and the like by sub-classing from the standard ConfigParser library. Please see the ConfigParser documentation for full usage of the class.
Additional arguments and keyword arguments are passed directly to RawConfigParser on initialization.
- class Meta[source]
Bases:
object
Handler meta-data.
- label = 'configparser'
The string identifier of this handler.
- add_section(section)[source]
Adds a block section to the config.
- Parameters:
section (str) – The section to add.
- get(section, key, **kwargs)[source]
Return a configuration value based on
section.key
. Must honor environment variables if they exist to override the config… for exampleconfig['myapp']['foo']['bar']
must be overridable by the environment variableMYAPP_FOO_BAR
…. Note thatMYAPP_
must prefix all vars, thereforeconfig['redis']['foo']
would be overridable byMYAPP_REDIS_FOO
… butconfig['myapp']['foo']['bar']
would not have a double prefix ofMYAPP_MYAPP_FOO_BAR
.
- get_dict()[source]
Return a dict of the entire configuration.
- Returns:
A dictionary of the entire config.
- Return type:
- get_section_dict(section)[source]
Return a dict representation of a section.
- Parameters:
section – The section of the configuration.
- Returns:
Dictionary reprisentation of the config section.
- Return type:
- get_sections()[source]
Return a list of configuration sections.
- Returns:
List of sections
- Return type: