Issue #16324: _charset parameter of MIMEText now also accepts email.charset.Charset instances.

Initial patch by Claude Paroz.
This commit is contained in:
Berker Peksag 2014-09-27 00:57:29 +03:00
parent 081bbf6b28
commit fe21e4d4d7
5 changed files with 16 additions and 1 deletions

View file

@ -1636,6 +1636,10 @@ class TestMIMEText(unittest.TestCase):
msg = MIMEText('hello there', _charset='us-ascii')
eq(msg.get_charset().input_charset, 'us-ascii')
eq(msg['content-type'], 'text/plain; charset="us-ascii"')
# Also accept a Charset instance
msg = MIMEText('hello there', _charset=Charset('utf-8'))
eq(msg.get_charset().input_charset, 'utf-8')
eq(msg['content-type'], 'text/plain; charset="utf-8"')
def test_7bit_input(self):
eq = self.assertEqual