summaryrefslogtreecommitdiffstats
path: root/Lib/email/generator.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2012-07-23 02:32:17 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2012-07-23 02:32:17 (GMT)
commit392bfd30af8cf87801c724d5964f4b5b088b025d (patch)
tree6f1599939611894a9a3f9e4c4b53938c8d56b9ea /Lib/email/generator.py
parentd74062948d890ca787721dbefd3ab8caf518c554 (diff)
parent970bef295d390c5ceaedca0f095590cd381a3331 (diff)
downloadcpython-392bfd30af8cf87801c724d5964f4b5b088b025d.zip
cpython-392bfd30af8cf87801c724d5964f4b5b088b025d.tar.gz
cpython-392bfd30af8cf87801c724d5964f4b5b088b025d.tar.bz2
merge heads.
Diffstat (limited to 'Lib/email/generator.py')
-rw-r--r--Lib/email/generator.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/email/generator.py b/Lib/email/generator.py
index fcecf93..8413f3b 100644
--- a/Lib/email/generator.py
+++ b/Lib/email/generator.py
@@ -252,7 +252,11 @@ class Generator:
msg.set_boundary(boundary)
# If there's a preamble, write it out, with a trailing CRLF
if msg.preamble is not None:
- self.write(msg.preamble + self._NL)
+ if self._mangle_from_:
+ preamble = fcre.sub('>From ', msg.preamble)
+ else:
+ preamble = msg.preamble
+ self.write(preamble + self._NL)
# dash-boundary transport-padding CRLF
self.write('--' + boundary + self._NL)
# body-part
@@ -270,7 +274,11 @@ class Generator:
self.write(self._NL + '--' + boundary + '--')
if msg.epilogue is not None:
self.write(self._NL)
- self.write(msg.epilogue)
+ if self._mangle_from_:
+ epilogue = fcre.sub('>From ', msg.epilogue)
+ else:
+ epilogue = msg.epilogue
+ self.write(epilogue)
def _handle_multipart_signed(self, msg):
# The contents of signed parts has to stay unmodified in order to keep