diff options
author | Lucas Hoffmann <l-m-h@web.de> | 2017-08-21 23:20:42 +0200 |
---|---|---|
committer | Lucas Hoffmann <l-m-h@web.de> | 2017-08-21 23:23:41 +0200 |
commit | f475b96685686cb1f5597ac063de950f4efb0c85 (patch) | |
tree | b9488e14ae0043245d5ddc95ac6791c58671a140 | |
parent | 6ee21b330d369cc91a9ba99eb2ee010e9e19e624 (diff) |
Use cStringIO.StringIO to fix #1132
This undoes a small subset of the changes from
fa3dd1b04567c4ea03fa658c3838b569531c79f5 and thus fixes #1132.
The io.BytesIO object was not able to handle the unicode header names
that where returned by envelope.construct_mail, which in turn did just
copy them from the envelope header.
-rw-r--r-- | alot/helper.py | 3 | ||||
-rw-r--r-- | tests/helper_test.py | 1 |
2 files changed, 2 insertions, 2 deletions
diff --git a/alot/helper.py b/alot/helper.py index ce307875..1c569a23 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -10,6 +10,7 @@ from datetime import timedelta from datetime import datetime from collections import deque from io import BytesIO +from cStringIO import StringIO import logging import mimetypes import os @@ -606,7 +607,7 @@ def email_as_string(mail): :param mail: email to convert to string :rtype: str """ - fp = BytesIO() + fp = StringIO() g = Generator(fp, mangle_from_=False, maxheaderlen=78) g.flatten(mail) as_string = RFC3156_canonicalize(fp.getvalue()) diff --git a/tests/helper_test.py b/tests/helper_test.py index 4cfe704d..62e37ed8 100644 --- a/tests/helper_test.py +++ b/tests/helper_test.py @@ -390,7 +390,6 @@ class TestEmailAsString(unittest.TestCase): expected = '\r\n' self.assertEqual(actual, expected) - @unittest.expectedFailure def test_empty_message_with_unicode_header(self): """Test if unicode header keys can be used in an email that is converted to string with email_as_string().""" |