summaryrefslogtreecommitdiffstats
path: root/wallace/module_invitationpolicy.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-11-19 21:27:09 -0500
committerThomas Bruederli <bruederli@kolabsys.com>2014-11-19 21:27:09 -0500
commitd49a7ea6c05521995afa8b73fcf0e638931f83d9 (patch)
tree0dba2a27ac7e09bd59ea01d789855f78c6daaa78 /wallace/module_invitationpolicy.py
parentd65762d548ef3869db2947d7f74434708c0b0820 (diff)
downloadpykolab-d49a7ea6c05521995afa8b73fcf0e638931f83d9.tar.gz
Build iTip response and notification messages with unicode strings (#3926) + adjust tests
Diffstat (limited to 'wallace/module_invitationpolicy.py')
-rw-r--r--wallace/module_invitationpolicy.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/wallace/module_invitationpolicy.py b/wallace/module_invitationpolicy.py
index 753547c..6adf82d 100644
--- a/wallace/module_invitationpolicy.py
+++ b/wallace/module_invitationpolicy.py
@@ -970,6 +970,10 @@ def send_update_notification(object, receiving_user, old=None, reply=True):
from email.MIMEText import MIMEText
from email.Utils import formatdate
+ # encode unicode strings with quoted-printable
+ from email import charset
+ charset.add_charset('utf-8', charset.SHORTEST, charset.QP)
+
organizer = object.get_organizer()
orgemail = organizer.email()
orgname = organizer.name()
@@ -1053,12 +1057,12 @@ def send_update_notification(object, receiving_user, old=None, reply=True):
message_text += "\n" + _("*** This is an automated message. Please do not reply. ***")
# compose mime message
- msg = MIMEText(utils.stripped_message(message_text))
+ msg = MIMEText(utils.stripped_message(message_text), _charset='utf-8')
msg['To'] = receiving_user['mail']
msg['Date'] = formatdate(localtime=True)
- msg['Subject'] = _('"%s" has been updated') % (object.get_summary())
- msg['From'] = '"%s" <%s>' % (orgname, orgemail) if orgname else orgemail
+ msg['Subject'] = utils.str2unicode(_('"%s" has been updated') % (object.get_summary()))
+ msg['From'] = utils.str2unicode('"%s" <%s>' % (orgname, orgemail) if orgname else orgemail)
smtp = smtplib.SMTP("localhost", 10027)
@@ -1081,6 +1085,10 @@ def send_cancel_notification(object, receiving_user):
from email.MIMEText import MIMEText
from email.Utils import formatdate
+ # encode unicode strings with quoted-printable
+ from email import charset
+ charset.add_charset('utf-8', charset.SHORTEST, charset.QP)
+
log.debug(_("Send cancellation notification for %s %r to user %r") % (
object.type, object.uid, receiving_user['mail']
), level=8)
@@ -1111,12 +1119,12 @@ def send_cancel_notification(object, receiving_user):
message_text += "\n" + _("*** This is an automated message. Please do not reply. ***")
# compose mime message
- msg = MIMEText(utils.stripped_message(message_text))
+ msg = MIMEText(utils.stripped_message(message_text), _charset='utf-8')
msg['To'] = receiving_user['mail']
msg['Date'] = formatdate(localtime=True)
- msg['Subject'] = _('"%s" has been cancelled') % (object.get_summary())
- msg['From'] = '"%s" <%s>' % (orgname, orgemail) if orgname else orgemail
+ msg['Subject'] = utils.str2unicode(_('"%s" has been cancelled') % (object.get_summary()))
+ msg['From'] = utils.str2unicode('"%s" <%s>' % (orgname, orgemail) if orgname else orgemail)
smtp = smtplib.SMTP("localhost", 10027)