Commit 2c536abf authored by Andrew M. Kuchling's avatar Andrew M. Kuchling

[Bug #523301] ConfigParser.write() produces broken output for values that

   were originally rfc822-like line continuations.
   Modified version of a patch from Matthias Ralfs.
parent 8f177512
......@@ -344,7 +344,7 @@ class ConfigParser:
if self.__defaults:
fp.write("[DEFAULT]\n")
for (key, value) in self.__defaults.items():
fp.write("%s = %s\n" % (key, value))
fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t')))
fp.write("\n")
for section in self.sections():
fp.write("[" + section + "]\n")
......@@ -352,7 +352,7 @@ class ConfigParser:
for (key, value) in sectdict.items():
if key == "__name__":
continue
fp.write("%s = %s\n" % (key, value))
fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t')))
fp.write("\n")
def remove_option(self, section, option):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment