[yum-cvs] yum/config.py

Tim Lauridsen timlau at linux.duke.edu
Wed Aug 15 12:05:33 UTC 2007


 yum/config.py |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit cbbaf1a4f0f4246b43733f1c91c49cb3ad13d7f5
Author: Tim Lauridsen <tla at rasmil.dk>
Date:   Wed Aug 15 13:45:11 2007 +0200

    Make the BaseConfig write method work better and make it support
    other ConfigParser replacements like iniparse.compat.ConfigParser.

diff --git a/yum/config.py b/yum/config.py
index 6ae7d0d..00adb25 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -422,14 +422,14 @@ class BaseConfig(object):
                 raise ValueError("not populated, don't know section")
             section = self._section
 
-        fileobj.write('[%s]\n' % section)
-        # get options in ConfigParser object
+        # Updated the ConfigParser with the changed values    
         cfgOptions = self.cfg.options(section)
-        # Write options
         for name,value in self.iteritems():
             option = self.optionobj(name)
             if always is None or name in always or option.default != value or name in cfgOptions :
-                fileobj.write("%s=%s\n" % (name, option.tostring(value)))
+                self.cfg.set(section,name, option.tostring(value))
+        # write the updated ConfigParser to the fileobj.
+        self.cfg.write(fileobj)
 
     def getConfigOption(self, option, default=None):
         warnings.warn('getConfigOption() will go away in a future version of Yum.\n'



More information about the Yum-cvs-commits mailing list