[Python-bugs-list] [ python-Bugs-441279 ] ConfigParser.options return default opts
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 18 Apr 2002 20:34:09 -0700
Bugs item #441279, was opened at 2001-07-14 07:11
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=441279&group_id=5470
Category: Python Library
Group: None
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: eXom (jkuan)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: ConfigParser.options return default opts
Initial Comment:
I have a config file which has the following sections
------------------
[DEFAULT]
logLevel = 9
port = 17870
[SECURITY]
user = hello
-------------------
On python, if I do the followings:
Python 2.0 (#1, Oct 16 2000, 18:10:03)
[GCC 2.95.2 19991024 (release)] on linux2
Type "copyright", "credits" or "license" for more
information.
>>> from ConfigParser import *
>>> f = open('/tmp/testrc', 'r')
>>> a = ConfigParser()
>>> a.defaults()
{}
>>> a.readfp(f)
>>> a.defaults()
{'port': '17870', 'loglevel': '9'}
>>> a.options("SECURITY")
['port', 'user', 'loglevel'] <<<<<<<<!!!!!!!!!
>>>
I thought a.options("SECURITY") will only return
['user'], however it returns everything including the
default options.
I am a bit confused.
Thanks
Joe
----------------------------------------------------------------------
>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2002-04-18 23:33
Message:
Logged In: YES
user_id=3066
Based on a discussion with Guido, we think the right thing
is to avoid changing the ConfigParser module when the "bug"
can be worked around. We need a better way to handle this
kind of configuration data, and that's on my shoulders now
(I kinda volunteered ;).
Closing this as "Won't Fix" since it doesn't appear that the
submitter had a problem with the workaround.
----------------------------------------------------------------------
Comment By: Sean 'Shaleh' Perry (shaleh)
Date: 2002-03-06 16:51
Message:
Logged In: YES
user_id=37132
how do you see the implementation being changed? Looking through the python bug list, it is not always
clear where help is desired or able to be accepted.
----------------------------------------------------------------------
Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-07-19 10:36
Message:
Logged In: YES
user_id=3066
This is an accident of the implementation; had your DEFAULT
section been named anything else (such as DEFAULT-OPTIONS),
you would not have been bitten by this. It should not be
hard to rearrange the implementation to make the acquistion
of information from the set of default values less prone to
accidental interactions.
Assigning to myself.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=441279&group_id=5470