mirror of
https://github.com/python/cpython.git
synced 2025-08-28 04:35:02 +00:00
[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:
parent
10b3eac278
commit
00824ed733
1 changed files with 2 additions and 2 deletions
|
@ -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):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue