Bug#432512: Merging ConfigObj with list_value=False and list_value=True creates spurious double quotes
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/
Bug#432512: Merging ConfigObj with list_value=False and list_value=True creates spurious double quotes
Package: python-configobj Version: 4.4.0-1 Severity: normal Hello, thanks for maintaining ConfigObj. 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. This is the code that reproduces the problem: from configobj import ConfigObj from StringIO import StringIO # A normal ConfigObj co = ConfigObj() # Note: this is the same as doing: # co = ConfigObj(list_values = True) # If I use a ConfigObj with list_values=False, the problem does not # show. # Create a new section co[test] = dict() # Merge in options with list values turned off co1 = ConfigObj(list_values = False) co1[foo] = bar, baz co[test].merge(co1) # Write it out buf = StringIO() co.write(buf) # Read it again buf1 = StringIO(buf.getvalue()) co2 = ConfigObj(infile = buf1, list_values = False) # test/foo gets extra double quotes print co2[test][foo] The last line prints: bar, baz With double quotes: the double quotes have been parsed as part of the string, rather than stripped as syntactic sugar of the config file syntax. Ciao, Enrico -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 2.6.21-1-amd64 (SMP w/2 CPU cores) Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages python-configobj depends on: ii python-support0.6.4 automated rebuilding support for p python-configobj recommends no packages. -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]