From: Jeremy Kerr Date: Tue, 10 Aug 2010 03:41:58 +0000 (+0800) Subject: tests/utils: Specify content encoding on MIMEText() construction X-Git-Url: http://git.ozlabs.org/?a=commitdiff_plain;h=112de5d5dc557dc660701a6686dbd47033bff19e;p=patchwork tests/utils: Specify content encoding on MIMEText() construction Signed-off-by: Jeremy Kerr --- diff --git a/apps/patchwork/tests/utils.py b/apps/patchwork/tests/utils.py index 7166ed2..02e0523 100644 --- a/apps/patchwork/tests/utils.py +++ b/apps/patchwork/tests/utils.py @@ -92,17 +92,16 @@ def create_email(content, subject = None, sender = None, multipart = False, sender = defaults.sender if project is None: project = defaults.project + if content_encoding is None: + content_encoding = 'us-ascii' if multipart: msg = MIMEMultipart() - body = MIMEText(content, _subtype = 'plain') - if content_encoding is not None: - body.set_charset(content_encoding) + body = MIMEText(content, _subtype = 'plain', + _charset = content_encoding) msg.attach(body) else: - msg = MIMEText(content) - if content_encoding is not None: - msg.set_charset(content_encoding) + msg = MIMEText(content, _charset = content_encoding) msg['Subject'] = subject msg['From'] = sender