summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2001-03-22 03:03:41 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2001-03-22 03:03:41 (GMT)
commitdf66df0a286c5d09022e7efe839759797318506c (patch)
tree69c66283ecd9edc223b30d1b241dc0d393e01341
parentbc32024769eecd3c2251e00850e6a5c003aa9253 (diff)
downloadcpython-df66df0a286c5d09022e7efe839759797318506c.zip
cpython-df66df0a286c5d09022e7efe839759797318506c.tar.gz
cpython-df66df0a286c5d09022e7efe839759797318506c.tar.bz2
Patch #407434: add rfc822_escape utility function
-rw-r--r--Lib/distutils/util.py10
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
+
+