From f21ae833caab6dad61d0b0feba6c54f6f0fdad13 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 11 Dec 2009 01:36:30 +0000 Subject: [PATCH] Defaults are written to .ini as comments svn: r13753 --- src/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/config.py b/src/config.py index 26b422c1c..c93c3d007 100644 --- a/src/config.py +++ b/src/config.py @@ -227,9 +227,13 @@ 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\n")% (key, repr(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