[Patches] [ python-Patches-865455 ] ConfigParser: fixes mixed-case interpolations (bug 857881)

SourceForge.net noreply at sourceforge.net
Mon Apr 26 19:52:41 EDT 2004


Patches item #865455, was opened at 2003-12-24 12:25
Message generated for change (Settings changed) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=865455&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Jordan R McCoy (jrm)
>Assigned to: Nobody/Anonymous (nobody)
Summary: ConfigParser: fixes mixed-case interpolations (bug 857881)

Initial Comment:
(Python CVS on FreeBSD 4.7 release)

ConfigParser translates option names into full lowercase 
before associating them with the section dictionary (in 
function RawConfigParser->optionxform, used multiple 
locations); this seems to indicate that option names 
should be interpreted in a case-insensitive manner.

However, the interpolation function in ConfigParser 
(_interpolate), uses the standard % string substitution 
construct, which is of course case-sensitive...thus,  
interpolations like '%(logFilename)' generate an 
exception. (See bug report 857881 for test case.)

This patch translates interpolations to full lowercase 
using a regular expression substitution before they are 
interpolated.

Since interpolations may run multiple times depending on 
their depth, this isn't the optimal solution, but is 
probably faster then the tokenizer interpolation used by 
SafeConfigParser. 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=865455&group_id=5470



More information about the Patches mailing list