Home | Trees | Index | Help |
---|
Module zcfg_addon |
|
ZConfig extension that allows one to modify and save the configuration.
The ZConfig library parses a config file, validating it against a schema, and returns a hierarchy of objects with matching keys and values.
There are a number of use cases where the config values have to be modified, and the resulting config has to be saved to file. In addition, it is sometimes convenient to convert the hierarchy of objects representing the config, to and from a hierarchy of nested dictionaries.
This extension implements such functionality by adding, at runtime, five methods, one function and one class to the imported ZConfig modules and classes, avoiding changes to the ZConfig source code.
It has been tested using ZConfig v.2.2 and Python v.2.3.
See the test function source code for examples of usage of the methods, function and class.
Version:
0.2
Author:
Nicola Larosa
Contact:
License:
MIT license; see LICENSE file
Classes | |
---|---|
ZConfigGenerator |
ZConfig config file generator extension. |
Function Summary | |
---|---|
Add a flat section (no subsections) to a Multisection object. | |
Add one value to a Multikey object. | |
Delete a section from a Multisection object. | |
Delete a value from a Multikey object. | |
SectionValue |
Build a SectionValue config object from a conforming dictionary. |
Modify a simple value. | |
Main testing function, invoked when the script is launched. | |
dict |
Convert a SectionValue object to a dictionary. |
Variable Summary | |
---|---|
str |
__revision__ : summary of metadata from the Subversion repository |
str |
__version__ : string computed from the versionInfo value |
str |
FALSE_STR : False bool value in generated text, may be no, off,
false |
str |
TRUE_STR : True bool value in generated text, may be yes, on,
true |
tuple |
versionInfo : tuple with current major and minor version numbers |
Function Details |
---|
addSectionToMultisection(self, typeName, valDict)Add a flat section (no subsections) to a Multisection object. Method added to the ZConfig.matcher.SectionValue class.
|
addValueToMultikey(self, name, val)Add one value to a Multikey object. Method added to the ZConfig.matcher.SectionValue class.
|
delSectionFromMultisection(self, typeName, idx)Delete a section from a Multisection object. Method added to the ZConfig.matcher.SectionValue class.
|
delValueFromMultikey(self, name, idx)Delete a value from a Multikey object. Method added to the ZConfig.matcher.SectionValue class.
|
fromDict(schema, cfgDict)Build a SectionValue config object from a conforming dictionary. Factory function added to the ZConfig.loader module.
|
modSingleValue(self, name, val)Modify a simple value. Method added to the ZConfig.matcher.SectionValue class.
|
test()Main testing function, invoked when the script is launched. Contains usage examples of the added methods, class and function. |
toDict(self, sectName=None)Convert a SectionValue object to a dictionary. Recursive method added to the ZConfig.matcher.SectionValue class.
|
Variable Details |
---|
__revision__summary of metadata from the Subversion repository
|
__version__string computed from the versionInfo value
|
FALSE_STRFalse bool value in generated text, may be no, off, false
|
TRUE_STRTrue bool value in generated text, may be yes, on, true
|
versionInfotuple with current major and minor version numbers
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Mon Mar 7 23:23:19 2005 | http://epydoc.sf.net |