From: Michael W. Hudson Date: Fri, 15 Mar 2002 10:24:14 +0000 (+0000) Subject: I presume this should go here. X-Git-Tag: v2.2.1c1~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c790c975d78a3d7519247c119eda791121195ff0;p=thirdparty%2FPython%2Fcpython.git I presume this should go here. 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. --- diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py index 190b6942f35b..bdce25ef0d35 100644 --- a/Lib/ConfigParser.py +++ b/Lib/ConfigParser.py @@ -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):