From: Andrew M. Kuchling Date: Thu, 22 Mar 2001 03:03:41 +0000 (+0000) Subject: Patch #407434: add rfc822_escape utility function X-Git-Tag: v2.1b2~91 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=df66df0a286c5d09022e7efe839759797318506c;p=thirdparty%2FPython%2Fcpython.git Patch #407434: add rfc822_escape utility function --- diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index e59615042252..010db9a3b0dd 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 + +