[Python-checkins] python/dist/src/Lib ConfigParser.py,1.66,1.67

goodger at users.sourceforge.net goodger at users.sourceforge.net
Sun Oct 3 17:40:27 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20319/Lib

Modified Files:
	ConfigParser.py 
Log Message:
SF bug #1017864: ConfigParser now correctly handles default keys, processing them with ``ConfigParser.optionxform`` when supplied, consistent with the handling of config file entries and runtime-set options.

Index: ConfigParser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- ConfigParser.py	18 May 2004 04:24:02 -0000	1.66
+++ ConfigParser.py	3 Oct 2004 15:40:24 -0000	1.67
@@ -202,10 +202,10 @@
 class RawConfigParser:
     def __init__(self, defaults=None):
         self._sections = {}
-        if defaults is None:
-            self._defaults = {}
-        else:
-            self._defaults = defaults
+        self._defaults = {}
+        if defaults:
+            for key, value in defaults.items():
+                self._defaults[self.optionxform(key)] = value
 
     def defaults(self):
         return self._defaults
@@ -511,8 +511,9 @@
             if section != DEFAULTSECT:
                 raise NoSectionError(section)
         # Update with the entry specific variables
-        if vars is not None:
-            d.update(vars)
+        if vars:
+            for key, value in vars.items():
+                d[self.optionxform(key)] = value
         option = self.optionxform(option)
         try:
             value = d[option]
@@ -544,7 +545,8 @@
                 raise NoSectionError(section)
         # Update with the entry specific variables
         if vars:
-            d.update(vars)
+            for key, value in vars.items():
+                d[self.optionxform(key)] = value
         options = d.keys()
         if "__name__" in options:
             options.remove("__name__")



More information about the Python-checkins mailing list