ANN: ConfigObj 4.7.2 Release

Michael Foord fuzzyman at voidspace.org.uk
Tue Mar 2 16:23:30 CET 2010


A new version of ConfigObj has just been released: 4.7.2

This is a bugfix release with several important bugfixes. It is 
recommended that all users of ConfigObj 4.7 update.

* Download: http://www.voidspace.org.uk/downloads/configobj-4.7.2.zip
* PyPI Page: http://pypi.python.org/pypi/configobj
* Documentation: http://www.voidspace.org.uk/python/configobj.html

The new version can be installed with::

     pip install -U configobj

Changelog
========

* BUGFIX: Restore Python 2.3 compatibility
* BUGFIX: Members that were lists were being returned as copies due to
    interpolation introduced in 4.7. Lists are now only copies if 
interpolation
    changes a list member. (See below.)
* BUGFIX: ``pop`` now does interpolation in list values as well.
* BUGFIX: where interpolation matches a section name rather than a value
    it is ignored instead of raising an exception on fetching the item.
* BUGFIX: values that use interpolation to reference members that don't
    exist can now be repr'd.
* BUGFIX: Fix to avoid writing '\r\r\n' on Windows when `write` is given
    a file opened in text mode ('w').

See below for important details on the change to using list values with 
string interpolation.

What is ConfigObj?
==============

**ConfigObj** is a simple but powerful config file reader and writer: an 
*ini
file round tripper*. Its main feature is that it is very easy to use, with a
straightforward programmer's interface and a simple syntax for config files.
ConfigObj has a host of powerful features:

* Nested sections (subsections), to any level
* List values
* Multiple line values
* Full Unicode support
* String interpolation (substitution)
* Integrated with a powerful validation system

     - including automatic type checking/conversion
     - and allowing default values
     - repeated sections

* All comments in the file are preserved
* The order of keys/sections is preserved
* Powerful ``unrepr`` mode for storing/retrieving Python data-types

String Interpolation and List Values
=========================

For general information on string interpolation in ConfigObj see:
http://www.voidspace.org.uk/python/configobj.html#string-interpolation

Since version 4.7 string interpolation is done on string members of list 
values. If interpolation changes any members of the list then what you 
get back is a /copy/ of the list rather than the original list.

This makes fetching list values slightly slower when interpolation is 
on, it also means that if you mutate the list changes won't be reflected 
in the original list:

>>>  c  =  ConfigObj()
>>>  c['foo']  =  'boo'
>>>  c['bar']  =  ['%(foo)s']
>>>  c['bar']
['boo']
>>>  c['bar'].append('fish')
>>>  c['bar']
['boo']

Instead of mutating the list you must create a new list and reassign it.



-- 
http://www.ironpythoninaction.com/



More information about the Python-announce-list mailing list