|
From: David H. <neg...@gm...> - 2008-11-18 22:23:25
|
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 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
|