cfgparse.config | index |
Implements basic mechanisms for managing configuration information
* A NAMESPACE is a collection of values and other namepsaces
* A VALUE is a basic value, like 3.1415, or 'Hello World!'
* A NAME identifies a value or namespace within a namespace
The namespace class is an abstract class that defines the basic
interface implemented by all namespace objects. Two concrete
implementations are include: basic_namespace and ini_namespace.
Each is described in detail elsewhere. However, here's an
example of the capabilities available:
Create namespace and populate it:
>>> n = basic_namespace()
>>> n.playlist.expand_playlist = True
>>> n.ui.display_clock = True
>>> n.ui.display_qlength = True
>>> n.ui.width = 150
Examine data:
>>> print n.playlist.expand_playlist
True
>>> print n['ui']['width']
150
>>> print n
playlist.expand_playlist = True
ui.display_clock = True
ui.display_qlength = True
ui.width = 150
Delete items:
>>> del n.playlist
>>> print n
ui.display_clock = True
ui.display_qlength = True
ui.width = 150
Convert it to ini format:
>>> from cfgparse import iniparser
>>> i = iniparser.ini_namespace()
>>> i.import_namespace(n)
>>> print i
[ui]
display_clock = True
display_qlength = True
width = 150
Classes | ||||||||||||||||||||||
|