[PATCH] D46186: [LNT] Make content of send emails to be in utf-8.
Martin Liška via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 10 02:09:58 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL331968: Make content of send emails to be in utf-8. (authored by marxin, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D46186?vs=144323&id=146098#toc
Repository:
rL LLVM
https://reviews.llvm.org/D46186
Files:
lnt/trunk/lnt/lnttool/main.py
lnt/trunk/lnt/util/NTEmailReport.py
Index: lnt/trunk/lnt/util/NTEmailReport.py
===================================================================
--- lnt/trunk/lnt/util/NTEmailReport.py
+++ lnt/trunk/lnt/util/NTEmailReport.py
@@ -23,7 +23,7 @@
# Generate a plain text message if we have no html report.
if not html_report:
- msg = email.mime.text.MIMEText(report)
+ msg = email.mime.text.MIMEText(report.encode('utf-8'), 'plain', 'utf-8')
msg['Subject'] = subject
msg['From'] = email_config.from_address
msg['To'] = to
@@ -36,8 +36,8 @@
# Attach parts into message container, according to RFC 2046, the last
# part of a multipart message, in this case the HTML message, is best
# and preferred.
- msg.attach(email.mime.text.MIMEText(report, 'plain'))
- msg.attach(email.mime.text.MIMEText(html_report, 'html'))
+ msg.attach(email.mime.text.MIMEText(report.encode('utf-8'), 'plain', 'utf-8'))
+ msg.attach(email.mime.text.MIMEText(html_report.encode('utf-8'), 'html', 'utf-8'))
s = smtplib.SMTP(email_config.host)
s.sendmail(email_config.from_address, [to], msg.as_string())
Index: lnt/trunk/lnt/lnttool/main.py
===================================================================
--- lnt/trunk/lnt/lnttool/main.py
+++ lnt/trunk/lnt/lnttool/main.py
@@ -269,7 +269,7 @@
% (config.zorgURL, database, testsuite)
subject = "Daily Report: %04d-%02d-%02d" % (
report.year, report.month, report.day)
- html_report = report.render(ts_url, only_html_body=False)
+ html_report = report.render(ts_url, only_html_body=False).encode('utf-8')
if subject_prefix is not None:
subject = "%s %s" % (subject_prefix, subject)
@@ -279,7 +279,7 @@
msg['Subject'] = subject
msg['From'] = from_address
msg['To'] = address
- msg.attach(email.mime.text.MIMEText(html_report, "html"))
+ msg.attach(email.mime.text.MIMEText(html_report, 'html', 'utf-8'))
# Send the report.
if not dry_run:
@@ -354,9 +354,9 @@
env = lnt.server.ui.app.create_jinja_environment()
text_template = env.get_template('reporting/run_report.txt')
- text_report = text_template.render(data)
+ text_report = text_template.render(data).encode('utf-8')
html_template = env.get_template('reporting/run_report.html')
- html_report = html_template.render(data)
+ html_report = html_template.render(data).encode('utf-8')
subject = data['subject']
if subject_prefix is not None:
@@ -367,8 +367,8 @@
msg['Subject'] = subject
msg['From'] = from_address
msg['To'] = to_address
- msg.attach(email.mime.text.MIMEText(text_report, 'plain'))
- msg.attach(email.mime.text.MIMEText(html_report, 'html'))
+ msg.attach(email.mime.text.MIMEText(text_report, 'plain', 'utf-8'))
+ msg.attach(email.mime.text.MIMEText(html_report, 'html', 'utf-8'))
# Send the report.
if not dry_run:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46186.146098.patch
Type: text/x-patch
Size: 3076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180510/d33c25c5/attachment-0001.bin>
More information about the llvm-commits
mailing list