|
From: Fuzzyman <fuz...@vo...> - 2006-03-17 12:49:24
|
Louis Cordier wrote:
> [snip..]
>
> Here is an example where walk() doesn't honour my configspec's order.
> For my needed end result, I don't really need walk() to do it in
> order thought.
>
>>>> configspec = '''
> ... [test]
> ... c = string(default='c')
> ... b = string(default='b')
> ... a = string(default='a')
> ... z = string(default='z')
> ... '''
>
>>>> c = ConfigObj(options={'configspec': configspec.split('\n')})
>>>> from validate import Validator
>>>> validator = Validator()
>>>> c.validate(validator)
> True
>>>> c
> {'test': {'a': 'a', 'c': 'c', 'b': 'b', 'z': 'z'}}
Note that here the order is *already* incorrect. So validate doesn't
honour the order of the configspec. This is because the configspec is
stored in a dictionary attached to the section - looks like I need to
*also* store the order. I don't think I'll make that a public attribute
though.
As far as I can tell from the code, ``walk`` *ought* to honour the
order. I think this is why you are seeing it sometimes honour and
sometimes not.
Fuzzyman
http://www.voidspace.org.uk/python/configobj.html
|