[Python-bugs-list] [ python-Bugs-511737 ] Bug/limitation in ConfigParser

noreply@sourceforge.net noreply@sourceforge.net
Fri, 01 Feb 2002 07:35:38 -0800


Bugs item #511737, was opened at 2002-02-01 07:35
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=511737&group_id=5470

Category: Python Library
Group: Feature Request
Status: Open
Resolution: None
Priority: 5
Submitted By: Loïc Lefort (loicl)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bug/limitation in ConfigParser

Initial Comment:
It is not possible to use '%' character in config
options in combination with $() substitution.
Example: Given this configuration file:

[DEFAULT]
option1=xxx
option2=%(option1)s/xxx

ok=%(option1)s/%%s
not_ok=%(option2)s/%%s

config.get('DEFAULT', 'ok') returns xxx/%s
but config.get('DEFAULT', 'not_ok') fails with an
exception because the '%' needs to be escaped multiple
times depending on the evaluation depth:

%(option2)s/%%s -> %(option1)s/xxx/%s -> exception

what I would like it to do is:
%(option2)s/%%s -> %(option1)s/xxx/%%s -> xxx/xxx/%s

Attached to this bug report is a simple patch to work
around this limitation (not very elegant, but it works)



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

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=511737&group_id=5470