[Python-checkins] CVS: distutils/distutils util.py,1.62,1.63
A.M. Kuchling
akuchling@users.sourceforge.net
Fri, 23 Mar 2001 09:30:28 -0800
Update of /cvsroot/python/distutils/distutils
In directory usw-pr-cvs1:/tmp/cvs-serv2735
Modified Files:
util.py
Log Message:
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)
Index: util.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/util.py,v
retrieving revision 1.62
retrieving revision 1.63
diff -C2 -r1.62 -r1.63
*** util.py 2001/03/22 03:03:41 1.62
--- util.py 2001/03/23 17:30:26 1.63
***************
*** 447,454 ****
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.
"""
! header = string.rstrip(header)
! header = string.replace(header, '\n', '\n ')
return header
--- 447,455 ----
def rfc822_escape (header):
"""Return a version of the string escaped for inclusion in an
! RFC-822 header, by ensuring there are 8 spaces space after each newline.
"""
! lines = string.split(header, '\n')
! lines = map(string.strip, lines)
! header = string.join(lines, '\n' + 8*' ')
return header