summaryrefslogtreecommitdiffstats
path: root/Lib/email/generator.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-11-21 16:53:48 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-11-21 16:53:48 (GMT)
commit719a449ba6ee2390758efa0751bbb1277bd61174 (patch)
tree67fac05f24f9aeac5f14ead5ad9bfc7e60012613 /Lib/email/generator.py
parent0a4dae5309ab30d3a217d3eb0329e3b3feec736c (diff)
downloadcpython-719a449ba6ee2390758efa0751bbb1277bd61174.zip
cpython-719a449ba6ee2390758efa0751bbb1277bd61174.tar.gz
cpython-719a449ba6ee2390758efa0751bbb1277bd61174.tar.bz2
Fix TestBytesGeneratorIdempotent tests and a couple bugs they revealed.
The tests that were failing on (some) windows machines, where the msg_XX.txt files used native \r\n lineseps are now also run on machines that use \n natively, and conversely the \n tests are run on Windows. The failing tests revealed one place where linesep needed to be added to a flatten call in generator. There was also another that the tests didn't catch, so I added a test for that case as well.
Diffstat (limited to 'Lib/email/generator.py')
-rw-r--r--Lib/email/generator.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/email/generator.py b/Lib/email/generator.py
index 05019d9..086cf4b 100644
--- a/Lib/email/generator.py
+++ b/Lib/email/generator.py
@@ -274,7 +274,7 @@ class Generator:
for part in msg.get_payload():
s = self._new_buffer()
g = self.clone(s)
- g.flatten(part, unixfrom=False)
+ g.flatten(part, unixfrom=False, linesep=self._NL)
text = s.getvalue()
lines = text.split(self._encoded_NL)
# Strip off the unnecessary trailing empty line
@@ -301,7 +301,7 @@ class Generator:
# in that case we just emit the string body.
payload = msg.get_payload()
if isinstance(payload, list):
- g.flatten(msg.get_payload(0), unixfrom=False)
+ g.flatten(msg.get_payload(0), unixfrom=False, linesep=self._NL)
payload = s.getvalue()
self._fp.write(payload)