Re: [Rest2web-develop] Last Commit
Brought to you by:
mjfoord
From: Nicola L. <ni...@te...> - 2005-08-07 18:21:28
|
Some work done this weekend. I'll refer a few times to ZConfig, please bear with me. ;-) First, I committed the files from your email. Then I fixed the doctests for both configobj.py and validate.py to make them work on Python 2.2.3 . I even tried Python 2.1.3, but it would have taken too many changes, so I dropped it. Only one test, for validate.py, still fails on 2.2.3, for trivial reasons. Finally I converted a rather elaborate config file from ZConfig format to Configobj. All is well as far as values go, but I have two non-trivial problems with validation. The first one: there is no default value. There should be a way to check a param's value, when it is set in the config file, or else to fill in a default value when it is not. As it is, one may leave the configspec empty, meaning that the value may not be present: alas, by doing so one loses any check on the value, and there's no default value anyway. This default value business is very handy, because it allows to specify, in the config file, just the values that differ from the defaults. The second problem is deeper: the configspec is monolitic, and I need it to be modular. That is, some sections contain a number of homogeneous subsections, and there's no way to know beforehand how many they will be. They should reuse the same configspec, so should be somehow declared of a certain "type", and validation should have a way to pick the right configspec fragment. This may be related to what you wrote: > Hmmm... Well I want to get validate working as a Section attribute rather > than an attribute just on ConfigObj... ZConfig does this by reusing section types in "multisections". Probably we could do something similar by validating the configspec for Sections, and then composing them in the complete configspec for the ConfigObj. By the way, maybe you could give a look to the ZConfig doc PDF, if you didn't already. There may be some good ideas in there, amidst all the formality ;-) : http://svn.zope.org/*checkout*/ZConfig/trunk/doc/zconfig.pdf?rev=30398 If we can solve these two problems, I think we can set the Configobj status straight to "beta", from my POV at least. ;-) -- Nicola Larosa - ni...@te... Abstraction is layering ignorance on top of reality. -- rpg, cited by Richard P. Gabriel, November 2002 |