Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit df66df0

Browse files
committed
Patch #407434: add rfc822_escape utility function
1 parent bc32024 commit df66df0

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Lib/distutils/util.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,3 +443,13 @@ def byte_compile (py_files,
443443
(file, cfile_base)
444444

445445
# byte_compile ()
446+
447+
def rfc822_escape (header):
448+
"""Return a version of the string escaped for inclusion in an
449+
RFC-822 header, by adding a space after each newline.
450+
"""
451+
header = string.rstrip(header)
452+
header = string.replace(header, '\n', '\n ')
453+
return header
454+
455+

0 commit comments

Comments
 (0)