|
From: Jack K. <kj...@gm...> - 2006-12-10 10:07:03
|
Hi all,
attached is my version of configobj.py modified from configobj 4.3.2. It
includes the following changes:
- pickling support
- list interpolation. For example:
k = 1,2,3
h = %(k)s
g = interpolate %(k)s into a string
f = interpolate, %(k)s, into, a, list
l = %(k)s,
can be interpreted as the following:
k = 1,2,3
h = "1,2,3"
g = "interpolate 1, 2, 3 into a string"
f = interpolate, 1, 2, 3, into, a, list
l = 1, 2, 3
- environment variable interpolation. Eg, %(PATH)e gives the value of the
PATH environment variable
- "section path interpolation". Example:
%(a/b/c/k)p interpolates the value of key, k, of subsection c of
subsection b of subsection a of the current section.
.. and . and absolute path can be used as well:
eg, %(../a/b/c/k)p %(/a/b/c/k)p
'/' can be escaped with \/ and . can be escaped with \.
- double % escapes interpolation, ie. %%(abc)s gives %(abc)s literally
- added two methods, lookup and fetch, to Section, to search a key upward
the tree.
The changes should be clear if you compare the configobj.py 4.3.2 with the
modified version.
I hope these features might be useful to others as well.
Thanks all!
Jack
|