|
From: Jack K. <kj...@gm...> - 2006-12-10 10:07:03
Attachments:
configobj.py
|
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
|
|
From: Nicola L. <ni...@te...> - 2006-12-10 17:49:11
|
Jack Kuan wrote: > Hi all, > > attached is my version of configobj.py modified from configobj 4.3.2. It > includes the following changes: > > [snip] > > 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! Thanks to you, Jack, I'll be working on them. Ideally, each new feature should be self-contained in a single unified-style patch (as output by the "diff -u" command), and accompanied by relevant patches to configobj_test.py and configobj.txt, for tests and docs. That would minimize our work, and considerably quicken the path to inclusion in the codebase. But ehi, I can't really complain. Keep those contributions coming! :-) -- Nicola Larosa - http://www.tekNico.net/ For over a year, Microsoft has planted a program on every modern Windows- powered PC that reported home every day. [...] Maybe you can trust your computer, your livelihood, your home finances, your kids' games, every- thing you do online, to a company that would do that, but you can count me out. -- Steven J. Vaughan-Nichols, June 2006 |
|
From: Nicola L. <ni...@te...> - 2006-12-30 11:07:04
|
Jack Kuan wrote: > Hi all, > > attached is my version of configobj.py modified from configobj 4.3.2. Sorry for the delay, Jack. At least we got to it within the month (and the year). :-) We talked about your proposed feature. The outcome is still open on a couple of them, but here goes. > It includes the following changes: > > - pickling support I don't like it. It doesn't seem very useful in this case, and pickling is fairly unmaintainable and insecure, I don't ever use it. But Michael has a more positive opinion about it, let's see how it pans out. > - 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 We don't see use specific use cases for this, so we're going to reject it. > - environment variable interpolation. Eg, %(PATH)e gives the value of > the PATH environment variable I think it may be useful, we're still looking into this. > - "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 \. This kind of syntactic sugar does not seem very useful, so it's not going in either. > - double % escapes interpolation, ie. %%(abc)s gives %(abc)s literally This is already in, as part of an earlier enhancement. > - added two methods, lookup and fetch, to Section, to search a key > upward the tree. As above, we don't see use specific use cases for this, so we're going to drop it too. In summary, one feature is already in, two are still in discussion, and three are not going in. Thanks for your contribution, and sorry for forcing you to keep maintaining you own fork; alas, ConfigObj is already fairly bloated, and we don't feel like keeping on bloating it without fairly good reasons. -- Nicola Larosa - http://www.tekNico.net/ All we're asking is that you stop spreading misinformation about the current state of dynamic languages to the press, analysts, and your customers. This does not require you to champion or otherwise support these technologies - just stop lying about them. -- Ryan Tomayko to James Gosling, March 2006 |
|
From: Jack K. <kj...@gm...> - 2006-12-31 13:10:38
|
Hi Nicola and all, thanks for your time in going through my proposed features. Although all of them were added because I felt convenient to have them while writing my own configuration files, I agree that not every one will like or need the same features. I shared my work with the hope that someone might find it useful; if it's integrated back to the project, that's great; if it's not accepted, I'm already grateful to have had the chance on improving the project and sharing and expressing my contributions! Thank you all, and happy new year! Jack On 12/30/06, Nicola Larosa <ni...@te...> wrote: > > Jack Kuan wrote: > > Hi all, > > > > attached is my version of configobj.py modified from configobj 4.3.2. > > Sorry for the delay, Jack. At least we got to it within the month (and the > year). :-) > > We talked about your proposed feature. The outcome is still open on a > couple of them, but here goes. > > > > It includes the following changes: > > > > - pickling support > > I don't like it. It doesn't seem very useful in this case, and pickling is > fairly unmaintainable and insecure, I don't ever use it. But Michael has a > more positive opinion about it, let's see how it pans out. > > > > - 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 > > We don't see use specific use cases for this, so we're going to reject it. > > > > - environment variable interpolation. Eg, %(PATH)e gives the value of > > the PATH environment variable > > I think it may be useful, we're still looking into this. > > > > - "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 \. > > This kind of syntactic sugar does not seem very useful, so it's not going > in either. > > > > - double % escapes interpolation, ie. %%(abc)s gives %(abc)s literally > > This is already in, as part of an earlier enhancement. > > > > - added two methods, lookup and fetch, to Section, to search a key > > upward the tree. > > As above, we don't see use specific use cases for this, so we're going to > drop it too. > > > In summary, one feature is already in, two are still in discussion, and > three are not going in. > > > Thanks for your contribution, and sorry for forcing you to keep > maintaining > you own fork; alas, ConfigObj is already fairly bloated, and we don't feel > like keeping on bloating it without fairly good reasons. > > > -- > Nicola Larosa - http://www.tekNico.net/ > > All we're asking is that you stop spreading misinformation about > the current state of dynamic languages to the press, analysts, and > your customers. This does not require you to champion or otherwise > support these technologies - just stop lying about them. > -- Ryan Tomayko to James Gosling, March 2006 > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > |