[Python-bugs-list] [ python-Bugs-441279 ] ConfigParser.options return default opts
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 06 Mar 2002 13:51:20 -0800
Bugs item #441279, was opened at 2001-07-14 04: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: Open
Resolution: None
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: Sean 'Shaleh' Perry (shaleh)
Date: 2002-03-06 13: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 07: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