From 112de5d5dc557dc660701a6686dbd47033bff19e Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Tue, 10 Aug 2010 11:41:58 +0800 Subject: tests/utils: Specify content encoding on MIMEText() construction Signed-off-by: Jeremy Kerr --- apps/patchwork/tests/utils.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'apps') 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 -- cgit v1.2.3