diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2001-03-22 03:03:41 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2001-03-22 03:03:41 (GMT) |
commit | df66df0a286c5d09022e7efe839759797318506c (patch) | |
tree | 69c66283ecd9edc223b30d1b241dc0d393e01341 /Lib/distutils | |
parent | bc32024769eecd3c2251e00850e6a5c003aa9253 (diff) | |
download | cpython-df66df0a286c5d09022e7efe839759797318506c.zip cpython-df66df0a286c5d09022e7efe839759797318506c.tar.gz cpython-df66df0a286c5d09022e7efe839759797318506c.tar.bz2 |
Patch #407434: add rfc822_escape utility function
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/util.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index e596150..010db9a 100644 --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -443,3 +443,13 @@ byte_compile(files, optimize=%s, force=%s, (file, cfile_base) # byte_compile () + +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 + + |