backend/common/rhnMail.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 42eb5654b42a77443d23381689a2d8822ae4a987
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri May 6 10:01:48 2011 +0200
fix utf-8 in emails
addressing:
Traceback (most recent call last):
File "/usr/bin/satellite-sync", line 176, in ?
systemExit_exception(7, "SYNC ERROR: attempting to display as much
information as possible:", e)
File "/usr/bin/satellite-sync", line 126, in systemExit_exception
satsync.sendMail(forceEmail=1)
File
"/usr/lib/python2.4/site-packages/spacewalk/satellite_tools/satsync.py", line
362, in sendMail
rhnMail.send(headers, body, sender=sndr)
File "/usr/lib/python2.4/site-packages/spacewalk/common/rhnMail.py", line
58, in send
msg = "%s\n%s\n" % (joined_headers, body)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 114:
ordinal not in range(128)
diff --git a/backend/common/rhnMail.py b/backend/common/rhnMail.py
index b96e2b9..93964bb 100644
--- a/backend/common/rhnMail.py
+++ b/backend/common/rhnMail.py
@@ -50,11 +50,11 @@ def send(headers, body, sender = None, lazy = 0):
(headers, toaddrs) = __check_headers(headers)
if sender is None:
sender = headers["From"]
- joined_headers = ''
+ joined_headers = u''
for h in headers.keys():
- joined_headers += "%s: %s\n" % (h, headers[h].encode('utf-8'))
+ joined_headers += u"%s: %s\n" % (h, headers[h])
server = smtplib.SMTP('localhost')
- msg = "%s\n%s\n" % (joined_headers, body)
+ msg = u"%s\n%s\n" % (joined_headers, body)
server.sendmail(sender, toaddrs, msg.encode('utf-8'))
server.quit()
Show replies by date