Em Ter, 2007-07-10 às 10:33 +0100, Enrico Zini escreveu:
> Hello,

Hey Enrico!

Sorry for the late response, work has been requiring loads of time
lately =/

> thanks for maintaining ConfigObj.

=D

> I'm using ConfigObj merge operations and list_value=False, and I've
> found that in some cases ConfigObj adds spurious double quotes artifacts
> to parsed string values.

So, I made some tests myself and decided it has nothing to do with the
merge operation, but with the fact that you are writing an object
configured to allow list values, and reading the result to an object
that does not allow that. The merge operation seems to be only copying
data from the merged object to an already configured 'configobj' object,
which seems correct.

ConfigObj's documentation states that one of its limitations is that it
won't quote/unquote when list_values=False, so it seems to be a known
problem:

        http://www.voidspace.org.uk/python/configobj.html#issues

I modified your code a bit to test:

        from configobj import ConfigObj
        from StringIO import StringIO
        
        co = ConfigObj()
        co["test"] = dict()
        co['test']['foo'] = 'bar, baz'
        
        buf = StringIO()
        co.write(buf)
        
        buf1 = StringIO(buf.getvalue())
        co2 = ConfigObj(infile = buf1, list_values = False)
        
        print co2["test"]["foo"]

Notice that if you remove the list_values keyword argument from the
second object it will work correctly. Since this problem is known to
upstream I'll tag it as forwarded. I'll see what I can do about
list_values=False not (un)quoting.

Thanks!

-- 
Gustavo Noronha <[EMAIL PROTECTED]>
http://kov.eti.br/


Reply via email to