[yum-cvs] yum/yum config.py,1.117,1.118

Tim Lauridsen timlau at linux.duke.edu
Tue Apr 17 09:25:37 UTC 2007


Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv28337/yum

Modified Files:
	config.py 
Log Message:
Fixed the baseconf write method so it:
* dont causes a Traceback.
* booleans are saved as "0" & "1", insted of "yes" & "no"
* Save all options read by the ConfigParser also if the values are default values.
* saves "option=value", insted of 'option = value'

Index: config.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/config.py,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -r1.117 -r1.118
--- config.py	4 Apr 2007 12:17:43 -0000	1.117
+++ config.py	17 Apr 2007 09:25:34 -0000	1.118
@@ -223,9 +223,9 @@
 
     def tostring(self, value):
         if value:
-            return "yes"
+            return "1"
         else:
-            return "no"
+            return "0"
 
 class FloatOption(Option):
     def parse(self, s):
@@ -436,13 +436,13 @@
             section = self._section
 
         fileobj.write('[%s]\n' % section)
-
+        # get options in ConfigParser object
+        cfgOptions = self.cfg.options(section)
         # Write options
-        for name, value in self.options:
+        for name, value in self.iteritems():
             option = self.optionobj(name)
-
-            if always is None or name in always or option.default != value:
-                fileobj.write("%s = %s\n" % (name, option.tostring(value)))
+            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)))
 
     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