diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2001-03-23 17:30:26 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2001-03-23 17:30:26 (GMT) |
commit | 88b0884787f06667f59ebaab5413f3bedcdd631c (patch) | |
tree | 28c87366d237ec3b7cb397a62da4179e815b6e3f /Lib/distutils/util.py | |
parent | aa90adcfb9ed2d5bed743e18e83489930296bd25 (diff) | |
download | cpython-88b0884787f06667f59ebaab5413f3bedcdd631c.zip cpython-88b0884787f06667f59ebaab5413f3bedcdd631c.tar.gz cpython-88b0884787f06667f59ebaab5413f3bedcdd631c.tar.bz2 |
Change rfc822_escape() to ensure there's a consistent amount of whitespace
after each newline, instead of just blindly inserting a space at
the start of each line. (Improvement suggested by Thomas Wouters)
Diffstat (limited to 'Lib/distutils/util.py')
-rw-r--r-- | Lib/distutils/util.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index 010db9a..01abd34 100644 --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -446,10 +446,11 @@ byte_compile(files, optimize=%s, force=%s, def rfc822_escape (header): """Return a version of the string escaped for inclusion in an - RFC-822 header, by adding a space after each newline. + RFC-822 header, by ensuring there are 8 spaces space after each newline. """ - header = string.rstrip(header) - header = string.replace(header, '\n', '\n ') + lines = string.split(header, '\n') + lines = map(string.strip, lines) + header = string.join(lines, '\n' + 8*' ') return header |