API Reference

Extend ConfigParser to add some inheritance functionality.

exception zconfigparser.ZDictError[source]

Base class for ZDict Exceptions.

exception zconfigparser.ZKeyError(key)[source]

Raised when no zkey is found.

exception zconfigparser.DuplicateZKeyError(new, old)[source]

Raised when duplicate zkeys are found.

exception zconfigparser.RecursiveZkeyError(key)[source]

Raised when circular zkey structure is found.

cf. ‘[aa : bb]’, ‘[bb : cc]’, ‘[cc : aa]’

exception zconfigparser.Error[source]

Base class for ZConfigParser Exceptions.

exception zconfigparser.NoZSectionError(section)[source]

Raised when no zsection is found.

exception zconfigparser.NoZOptionError(option, section)[source]

Raised when no option in a zsection is found.

class zconfigparser.ZDict(*args, **kwargs)[source]

A custom dictionary used in ZConfigParser.

It creates and keeps internal zsection dependency dictionaries. (They are ordinary dict). Without this, ZConfigParser has to search all sections all the time and is very slow.

zkeys()[source]

Collect all shortnames and longnames.

Two dictionary keys are combined (sections and zsections), so key ordering of OrderedDict part is not preserved.

class zconfigparser.ZDictGen(*args, **kwargs)[source]

A supplement class needed to create ZSEP pre-initialized ZDict.

To adjust for ConfigParser intialization argument dict_type.

class zconfigparser.ZConfigParser(*args, **kwargs)[source]

ConfigParser, plus some section inheritance function.

E.g. section [aa : bb] becomes [aa], and inherits and overrides section [bb]. Default separator word is ‘ : ‘, exactly one space before and after ‘:’.

get(section, option, **kwargs)[source]

Override ConfigParser’s method.

ZConfigParser only wraps Exceptions in get. Other ‘get’ (getint etc.) might leak (raise) ConfigParser’s Exceptions.

zsections()[source]

Return all section shortnames and longnames.

has_zsection(section)[source]

Check section name (whether short or long).

has_zoption(section, option)[source]

Check option name in a zsection (whether short or long).