mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
Issue #16324: _charset parameter of MIMEText now also accepts email.charset.Charset instances.
Initial patch by Claude Paroz.
This commit is contained in:
parent
081bbf6b28
commit
fe21e4d4d7
5 changed files with 16 additions and 1 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
__all__ = ['MIMEText']
|
||||
|
||||
from email.charset import Charset
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
|
||||
|
||||
|
|
@ -34,6 +35,8 @@ class MIMEText(MIMENonMultipart):
|
|||
_charset = 'us-ascii'
|
||||
except UnicodeEncodeError:
|
||||
_charset = 'utf-8'
|
||||
if isinstance(_charset, Charset):
|
||||
_charset = str(_charset)
|
||||
|
||||
MIMENonMultipart.__init__(self, 'text', _subtype,
|
||||
**{'charset': _charset})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue