]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[Bug #523301] ConfigParser.write() produces broken output for values that
authorAndrew M. Kuchling <amk@amk.ca>
Fri, 8 Mar 2002 18:08:47 +0000 (18:08 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Fri, 8 Mar 2002 18:08:47 +0000 (18:08 +0000)
   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):