class ConfigDict(dict):
A dict-like configuration storage with additional support for namespaces, validators, meta-data, on_change listeners and more.
This storage is optimized for fast read access. Retrieving a key
or using non-altering dict methods (e.g. dict.get()
) has no overhead
compared to a native dict.
Method | load_config |
Load values from an *.ini style config file. |
Method | load_dict |
Import values from a dictionary structure. Nesting can be used to represent namespaces. |
Method | meta_get |
Return the value of a meta field for a key. |
Method | meta_list |
Return an iterable of meta field names defined for a key. |
Method | meta_set |
Set the meta field for a key to a new value. This triggers the on-change handler for existing keys. |
Method | update |
If the first parameter is a string, all keys are prefixed with this namespace. Apart from that it works just as the usual dict.update(). Example: update('some.namespace', key='value') |
Class | Namespace |
Undocumented |
Method | __call__ |
Undocumented |
Method | __delattr__ |
Undocumented |
Method | __delitem__ |
Undocumented |
Method | __getattr__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __setattr__ |
Undocumented |
Method | __setitem__ |
Undocumented |
Method | clear |
Undocumented |
Method | setdefault |
Undocumented |
Class Variable | __slots__ |
Undocumented |
Instance Variable | _meta |
Undocumented |
Instance Variable | _on_change |
Undocumented |
Load values from an *.ini style config file.
If the config file contains sections, their names are used as namespaces for the values within. The two special sections DEFAULT and bottle refer to the root namespace (no prefix).
Import values from a dictionary structure. Nesting can be used to represent namespaces.
>>> ConfigDict().load_dict({'name': {'space': {'key': 'value'}}}) {'name.space.key': 'value'}