|
From: Michael F. <fuz...@vo...> - 2008-11-18 22:31:22
|
David Hostetler wrote: > I'm finally getting around to taking advantage of Validator (have been > using configobj for awhile), and unfortunately I'm finding that it > currently lacks a capability that is (for my purposes) a necessity. > > Basically, I need a repetition mechanisms that works for keyword=value > pairs. The '__many__' feature works for repeated subsections within a > given section, but I need something that lets me validate repeated > keywords within a given section. > > I.e., for a config like: > > [somesection] > foo = 1 > bar = 2 > > > I could define a configspec like so: > > [somesection] > __many__ = integer(default=0) > > That's a good idea. Let me check my time machine: http://www.voidspace.org.uk/python/weblog/arch_d7_2008_10_25.shtml#e1020 Yup, in Subversion and due for release soon. In the meantime you can try out the version in Subversion. https://svn.pythonutils.python-hosting.com/trunk/pythonutils/configobj.py Michael Foord > That would allow a config file to include an arbitrary number of > keyword=value pairs in the 'somesection' section, and I don't need a > priori knowledge of the full set (the very same logical justification > for the existing __many__ subsection feature). > > Without this capability, I'm compelled to restructure to something like this: > > [somesection] > [[foo]] > value = 1 > [[bar]] > value = 2 > > > with a configspec like: > > [somesection] > [[__many__]] > value = integer(default=0) > > > Which in my opinion is less syntactically efficient for the nature of > the data I need to support. That is - it forces another layer of > config sectional hierarchy where it isn't needed and it muddies the > namespace unnecessarily. > > > Is there a way to do this in the current implementation that I haven't > discovered, and if not - could this possibly be added as a new > capability? > > regards, > > -David > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog |