Re: [Rest2web-develop] Changed all references to value "tests" into value "checks"...
Brought to you by:
mjfoord
From: Michael F. <mi...@pc...> - 2005-07-21 14:45:37
|
Nicola Larosa wrote: >>I think it makes the config files look more confusing. We use >>indentation for nesting sections. *so*, you either use what I have done >>so far, or you have to indent values *inside* a section. >> >>Mine (a section indented uniformly) : >> >>key = value >>key2 = value2 >> [section] >> key = value >> key2 = value2 >> [sub-section] >> key = value >> key2 = value2 >> >> [section2] >> key = value >> key2 = value2 > > > Wait a minute, how is this compatible with std INI files? ConfigObj reads > them in flat, then writes them nested, but ConfigParser then keeps reading > them because it doesn't care for indent? > Hmmm... good point. Although ConfigObj (as it stands) will read standard section files - but it probably does change them when it writes them out. > They will *look* different to humans, though, after having passed through > ConfigObj. :-) > > > >>Yours (values indented differently from their markers) : > > > This is *not* what I was getting at. :-) > [snip..] > That's not my spec. Here's what I have in mind: > > key = value > key2 = value2 > > [section] > key = value > key2 = value2 > > # no scalar values allowed here > > [sub-section] > key = value > key2 = value2 > > # no scalar values allowed here > > [section2] > key = value > key2 = value2 > > In summary, starting from your version, I just suggest to dedent everything > one position (except for top level scalar values that are already at column > one, of course). > > This looks clearer to me, and if one doesn't use subsections, it is > *identical* to INI config files. > Ok - so we just special case the top level and restrict scalars to before any sections. That's not so bad :-) Should Section.__setitem__ raise an error if you attempt this, (bearing in mind that normally a new addition would be appended to the end of sequence) - or should it just put the values in the right place. I guess the second option is the right one. This means the ``write`` method needs to check all the members and write out the scalars first. *sigh* (This means it no longer necessarily obeys ``sequence``). > > >>Hmm... this has been then *only* implementation I've done of this (as >>shown in the tests) - so it's a long way down the road to start >>discussing the basics. > > > I don't get exactly what you imply by saying this. I wasn't there early on, > sure, but nonetheless I hope it's not too late to try and get the basics right. > > Au contraire my friend - I only started writing ConfigObj 4 on your promptings - so you *have* been here from the start. Which is why I'm surprised this didn't come up before.... Anyway - think I can sort it. Best Regards, Fuzzy http://www.voidspace.org.uk/python |