Re: [Rest2web-develop] Changed all references to value "tests" into value "checks"...
Brought to you by:
mjfoord
From: Nicola L. <ni...@te...> - 2005-07-21 09:12:57
|
> It is possible to create new ConfigObjs programatically. Either manually > - or by passing in a dictionary to create the ConfigObj. In both cases > it is possible to create a ConfigObj where the first item is a section. > This means that when you call the ``write`` method the resulting config > file looks like : > > [ section ] > key = value > key = value > > Which is *invalid* ! > My proposed solution is to have the ``write`` method check if the first > value is a section - and write out non-section values first (there may > not be any). This means not obeying sequence though, so it's not ideal. Something is fishy here. I did not yet look closely at the refactored code, so I'll only speak about concepts. As I understand it, the problem stems from the fact that the ConfigObj instance is a Section itself. Its rendering, though, should implicit, that is, without a section header, and without indenting for contained items, either subsections or scalar values. What I don't get is, what difference does it make what the first item is? All items contained in the ConfigObj instance should be "rendered" to text without indentation, whether they were passed in, or read from a file. So I'd say, no workarounds, let's look closer at what's happening. -- Nicola Larosa - ni...@te... When I was growing up, my parents used to say to me, "Tom, finish your dinner - people in China are starving." But after sailing to the edges of the flat world for a year, I am now telling my own daughters, "Girls, finish your homework - people in China and India are starving for your jobs." -- Thomas L. Friedman, New York Times, April 2005 |