Kaydet (Commit) 00824ed7 authored tarafından 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.
üst 10b3eac2
...@@ -344,7 +344,7 @@ class ConfigParser: ...@@ -344,7 +344,7 @@ class ConfigParser:
if self.__defaults: if self.__defaults:
fp.write("[DEFAULT]\n") fp.write("[DEFAULT]\n")
for (key, value) in self.__defaults.items(): 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") fp.write("\n")
for section in self.sections(): for section in self.sections():
fp.write("[" + section + "]\n") fp.write("[" + section + "]\n")
...@@ -352,7 +352,7 @@ class ConfigParser: ...@@ -352,7 +352,7 @@ class ConfigParser:
for (key, value) in sectdict.items(): for (key, value) in sectdict.items():
if key == "__name__": if key == "__name__":
continue continue
fp.write("%s = %s\n" % (key, value)) fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t')))
fp.write("\n") fp.write("\n")
def remove_option(self, section, option): 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