From 8a669909bcf58082ee2b388372075570f2b1fd64 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Wed, 6 Mar 2019 16:57:00 +0000 Subject: [PATCH] Changed ietf/utils/mail.py to use unicode strings, and changed a call in ietf/reviv/utils.py to use unicode for mail Subject, to fix a server 500 issue. - Legacy-Id: 16007 --- ietf/review/utils.py | 5 +++++ ietf/utils/mail.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ietf/review/utils.py b/ietf/review/utils.py index f70ea1ae8..631e3a7ea 100644 --- a/ietf/review/utils.py +++ b/ietf/review/utils.py @@ -1,3 +1,8 @@ +# -*- coding: utf-8 -*- +# Copyright The IETF Trust 2016-2019, All Rights Reserved +from __future__ import unicode_literals, print_function + + import datetime, re, itertools from collections import defaultdict, namedtuple diff --git a/ietf/utils/mail.py b/ietf/utils/mail.py index 61b4fe315..9bafa20c9 100644 --- a/ietf/utils/mail.py +++ b/ietf/utils/mail.py @@ -117,7 +117,7 @@ def send_smtp(msg, bcc=None): raise SMTPSomeRefusedRecipients(message="%d addresses were refused"%len(unhandled),original_msg=msg,refusals=unhandled) except Exception as e: # need to improve log message - log("Exception while trying to send email from '%s' to %s subject '%s'" % (frm, to, msg.get('Subject', '[no subject]'))) + log(u"Exception while trying to send email from '%s' to %s subject '%s'" % (frm, to, msg.get('Subject', '[no subject]'))) if isinstance(e, smtplib.SMTPException): e.original_msg=msg raise @@ -128,7 +128,7 @@ def send_smtp(msg, bcc=None): server.quit() except smtplib.SMTPServerDisconnected: pass - log("sent email from '%s' to %s id %s subject '%s'" % (frm, to, msg.get('Message-ID', ''), msg.get('Subject', '[no subject]'))) + log(u"sent email from '%s' to %s id %s subject '%s'" % (frm, to, msg.get('Message-ID', ''), msg.get('Subject', '[no subject]'))) def copy_email(msg, to, toUser=False, originalBcc=None): '''