summaryrefslogtreecommitdiff
path: root/pgcommitfest/commitfest/views.py
diff options
context:
space:
mode:
authorMagnus Hagander2017-03-11 18:33:08 +0000
committerMagnus Hagander2017-03-11 18:33:08 +0000
commitd745feae8d4e914f7b03d27465d6dfa495058097 (patch)
tree86968dc466275feb922b182db6387b9a2beaa4b9 /pgcommitfest/commitfest/views.py
parentd49b2b07a8b2422173142729fe8d7624de7ef4c5 (diff)
Fix header encoding for To and Cc as well
Patch in 2e41b31654b80aeb3e6037fc0b31422c951040c7 only handled From and missed the ohher tields. To make this cleaner, move the escpaping code into the UserWrapper class. Reported by Dagfinn Ilmari Mannsåker, but not using his patch
Diffstat (limited to 'pgcommitfest/commitfest/views.py')
-rw-r--r--pgcommitfest/commitfest/views.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py
index 11f427e..c3007b2 100644
--- a/pgcommitfest/commitfest/views.py
+++ b/pgcommitfest/commitfest/views.py
@@ -11,8 +11,7 @@ from django.conf import settings
from datetime import datetime
from email.mime.text import MIMEText
-from email.utils import formatdate, make_msgid, formataddr
-from email.header import Header
+from email.utils import formatdate, make_msgid
from pgcommitfest.mailqueue.util import send_mail, send_simple_mail
from pgcommitfest.userprofile.util import UserWrapper
@@ -366,12 +365,12 @@ def comment(request, cfid, patchid, what):
msg['Subject'] = 'Re: %s' % form.thread.subject
msg['To'] = settings.HACKERS_EMAIL
- msg['From'] = formataddr((str(Header(u"%s %s" % (request.user.first_name, request.user.last_name), 'utf-8')), UserWrapper(request.user).email))
+ msg['From'] = UserWrapper(request.user).encoded_email_header
# CC the authors of a patch, if there are any
authors = list(patch.authors.all())
if len(authors):
- msg['Cc'] = ", ".join(["%s %s <%s>" % (a.first_name, a.last_name, UserWrapper(a).email) for a in authors])
+ msg['Cc'] = ", ".join([UserWrapper(a).encoded_email_header for a in authors])
msg['Date'] = formatdate(localtime=True)
msg['User-Agent'] = 'pgcommitfest'