backend/common/rhnMail.py | 2 ++
1 file changed, 2 insertions(+)
New commits:
commit aa98e1613624db1d1e672af854de527e237e58b0
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue May 22 11:01:00 2012 +0200
decode unicode string on IDN machines
addressing:
Standard-error: 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
363, in sendMail
rhnMail.send(headers, body, sender=sndr)
File "/usr/lib/python2.4/site-packages/spacewalk/common/rhnMail.py", line
57, in send
msg = u"%s\n%s\n" % (joined_headers, body)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 47:
ordinal not in range(128)
diff --git a/backend/common/rhnMail.py b/backend/common/rhnMail.py
index f7e2ef0..c3c20d7 100644
--- a/backend/common/rhnMail.py
+++ b/backend/common/rhnMail.py
@@ -52,6 +52,8 @@ def send(headers, body, sender = None):
joined_headers += u"%s: %s\n" % (h, headers[h])
server = smtplib.SMTP('localhost')
+ if not isinstance(body, unicode):
+ body = body.decode('utf-8')
msg = u"%s\n%s\n" % (joined_headers, body)
server.sendmail(sender, toaddrs, msg.encode('utf-8'))
server.quit()
Show replies by date