Package turbogears :: Module config
[hide private]

Module config

source code

Classes [hide private]
  ConfigError
Functions [hide private]
 
_get_formatters(formatters) source code
 
_get_handlers(handlers, formatters) source code
 
_get_loggers(loggers, handlers) source code
 
configure_loggers(config)
Configures the Python logging module, using options that are very similar to the ones listed in the Python documentation.
source code
 
config_defaults() source code
 
config_obj(configfile=None, modulename=None) source code
 
update_config(configfile=None, modulename=None)
Updates the system configuration either from a ConfigObj (INI-style) config file, a module name specified in dotted notation or both (the module name is assumed to have a ".cfg" extension).
source code
 
get(key, default_value=None, return_section=False, path=None)
Retrieves a config value
source code
 
update(configvalues)
Updates the configuration with the values from the dictionary.
source code
Function Details [hide private]

configure_loggers(config)

source code 

Configures the Python logging module, using options that are very similar to the ones listed in the Python documentation. This also removes the logging configuration from the configuration dictionary because CherryPy doesn't like it there. Here are some of the Python examples converted to the format used here:

[logging] [[loggers]] [[[parser]]] [logger_parser] level="DEBUG" handlers="hand01" propagate=1 qualname="compiler.parser"

[[handlers]] [[[hand01]]] class="StreamHandler" level="NOTSET" formatter="form01" args="(sys.stdout,)"

[[formatters]] [[[form01]]] format="F1 *(asctime)s *(levelname)s *(message)s" datefmt=

One notable format difference is that *() is used in the formatter instead of %() because %() is already used for config file interpolation.

update_config(configfile=None, modulename=None)

source code 

Updates the system configuration either from a ConfigObj (INI-style) config file, a module name specified in dotted notation or both (the module name is assumed to have a ".cfg" extension). If both are specified, the module is called first, followed by the config file. This means that the config file's options override the options in the module file.