Defaults are written to .ini as comments

svn: r13753
This commit is contained in:
Doug Blank 2009-12-11 01:36:30 +00:00
parent a82b115192
commit f21ae833ca

View File

@ -227,9 +227,13 @@ class ConfigManager(object):
keys = sorted(self.data[section]) keys = sorted(self.data[section])
for key in keys: for key in keys:
value = self.data[section][key] value = self.data[section][key]
if value == self.get_default("%s.%s" % (section, key)):
default = ";;"
else:
default = ""
if isinstance(value, long): if isinstance(value, long):
value = int(value) 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.write("\n")
key_file.close() key_file.close()
# else, no filename given; nothing to save so do nothing quietly # else, no filename given; nothing to save so do nothing quietly