projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
aa90adc
)
Change rfc822_escape() to ensure there's a consistent amount of whitespace
author
Andrew M. Kuchling
<amk@amk.ca>
Fri, 23 Mar 2001 17:30:26 +0000
(17:30 +0000)
committer
Andrew M. Kuchling
<amk@amk.ca>
Fri, 23 Mar 2001 17:30:26 +0000
(17:30 +0000)
after each newline, instead of just blindly inserting a space at
the start of each line. (Improvement suggested by Thomas Wouters)
Lib/distutils/util.py
patch
|
blob
|
history
diff --git
a/Lib/distutils/util.py
b/Lib/distutils/util.py
index 010db9a3b0dde606a9680134976694390a8f5560..01abd346d5bd6749b73cc529c39bcb9cf75094cb 100644
(file)
--- 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