]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
I presume this should go here.
authorMichael W. Hudson <mwh@python.net>
Fri, 15 Mar 2002 10:24:14 +0000 (10:24 +0000)
committerMichael W. Hudson <mwh@python.net>
Fri, 15 Mar 2002 10:24:14 +0000 (10:24 +0000)
backport akuchling's checkin of
    revision 1.39 of ConfigParser.py

[Bug #523301] ConfigParser.write() produces broken output for values that
   were originally rfc822-like line continuations.
   Modified version of a patch from Matthias Ralfs.

Lib/ConfigParser.py

index 190b6942f35bad5d504e3cbda1338a6c403dc90a..bdce25ef0d358189bf6539f6cc9985d96e4443a3 100644 (file)
@@ -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):