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

were originally rfc822-like line continuations.
   Modified version of a patch from Matthias Ralfs.
This commit is contained in:
Andrew M. Kuchling 2002-03-08 18:08:47 +00:00
parent 10b3eac278
commit 00824ed733

View file

@ -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:
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):