From 91fb951d04c0f02f9aa199c6abef376cebab4887 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 11 Dec 2009 03:11:48 +0000 Subject: [PATCH] Fixed two bugs with one check: last wart is gone in config svn: r13755 --- src/config.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/config.py b/src/config.py index 95455fd37..570409ab9 100644 --- a/src/config.py +++ b/src/config.py @@ -227,13 +227,17 @@ class ConfigManager(object): keys = sorted(self.data[section]) for key in keys: value = self.data[section][key] - if value == self.get_default("%s.%s" % (section, key)): - default = ";;" - else: - default = "" - if isinstance(value, long): - value = int(value) - key_file.write(("%s%s=%s\n")% (default, key, repr(value))) + # If it has a default: + if self.has_default("%s.%s" % (section, key)): + if value == self.get_default("%s.%s" % (section, key)): + default = ";;" + else: + default = "" + if isinstance(value, long): + value = int(value) + key_file.write(("%s%s=%s\n")% (default, + key, + repr(value))) key_file.write("\n") key_file.close() # else, no filename given; nothing to save so do nothing quietly