|
From: Fuzzyman <fuz...@vo...> - 2006-03-17 16:40:42
|
Kevin Dangoor wrote: > On 3/17/06, Michael Foord <fuz...@gm...> wrote: > >>> foo="bar" >>> baz=True >>> blork=8 >>> > > [snip] > >> I can add an 'unrepr' mode as an optional keyword (default False) that >> implements it. >> > > You know what might be interesting: the ability to provide a callback > to set each value. That would allow plugging in of different sorts of > unrepr-style behavior. > Hmm... sounds a little bit heavyweight for a config file reader/writer. You can actually already do this by reading the config file in with ``list_values`` set to ``False``. (This stops the parsing of values - except to remove any comment and handle multi line values I think). You then use the ``walk`` method and pass in a callable which is called on every value and each value is substituted with the return. Properly handling lists would be a pain this way - you would want to leverage the code already in ConfigObj to do this. This however this isn't symmetric with ``write`` which *currently* won't quote a value if it doesn't need it - so a string value of '1' will be written without quotes. > Of course, there would have to be a companion function for handling > the writing side of things as well. > Do you envisage needing programmatic writing from Turbogears ? If not, ConfigObj can possibly already do what you want. I'm happy to implement ``unrepr`` mode *anyway*. All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml > Kevin > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642 > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > > |