Almost completed the translation of my main use case from ZConfig to
ConfigObj. Changed a few things:
configobj.py
------------
Reworked the ConfigObj._parse, _handle_error and _multiline methods:
mutated the self._infile, self._index and self._maxline attributes into
local variables and method parameters.
Reshaped the ConfigObj._multiline method to better reflect its semantics.
Changed the "default_test" test in ConfigObj.validate to check the fix for
the bug in validate.Validator.check (see below).
Added a test to SimpleVal: it does not seem able to intercept missing
values, please check it.
Commented out the following line in SimpleVal:
baseErrorClass = Exception
it's what causes the exception in doctest in Python2.2, and doesn't seem
needed anyway: if it is, write a test that uses it. :-)
validate.py
-----------
Fixed a bug in Validator.check: when a value that has a default is also
specified in the config file, the default must be deleted from fun_kwargs
anyway, otherwise the check function will get a spurious "default" keyword
argument.
Added an "ip_addr_list" check.
odict.py
--------
Cosmetic changes only, to get PyLint to give it a "10" score. It's the
first time I manage to do that. :-)
Maximum score from PyLint and extensive test coverage, that's probably the
best Python Ordered Dictionary in the known universe. ;-D
The last request
----------------
Really the last, I promise. O:-)
It's about required values, and required sections.
Currently, if a scalar has no default in the configspec, it must be
specified in the config, therefore in the end every scalar has a value. But
I need optional values, with no default, and possibly not specified in the
config, so that they may effectively be missing from the config obj.
We could decide that when a scalar is defined with "default = None", then
it means that it's required, otherwise it may be altogether absent from the
config. In that case, the default would be for all values not to be
required: the opposite would have to be explicitly specified.
A similar issue is the requiredness of sections: I need to be able to omit
entire sections from the config, and this is currently not possible. A
related issue would be specifying the min and max number of subsections in
__many__ sections.
All the rest works, the requiredness issue should be all that's missing for
my use case. What about it? :-)
--
Nicola Larosa - ni...@te...
Does it seem like I'm looking for an answer
To a question I can't ask
-- Norah Jones, Nightingale, Come Away with Me, 2001
|