diff options
author | Thomas Bruederli <bruederli@kolabsys.com> | 2014-11-19 21:27:09 -0500 |
---|---|---|
committer | Thomas Bruederli <bruederli@kolabsys.com> | 2014-11-19 21:27:09 -0500 |
commit | d49a7ea6c05521995afa8b73fcf0e638931f83d9 (patch) | |
tree | 0dba2a27ac7e09bd59ea01d789855f78c6daaa78 /wallace/module_resources.py | |
parent | d65762d548ef3869db2947d7f74434708c0b0820 (diff) | |
download | pykolab-d49a7ea6c05521995afa8b73fcf0e638931f83d9.tar.gz |
Build iTip response and notification messages with unicode strings (#3926) + adjust tests
Diffstat (limited to 'wallace/module_resources.py')
-rw-r--r-- | wallace/module_resources.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/wallace/module_resources.py b/wallace/module_resources.py index 0b4d811..d1833eb 100644 --- a/wallace/module_resources.py +++ b/wallace/module_resources.py @@ -1197,6 +1197,10 @@ def send_owner_notification(resource, owner, itip_event, success=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) + notify = False status = itip_event['xml'].get_attendee_by_email(resource['mail']).get_participant_status(True) @@ -1223,12 +1227,14 @@ def send_owner_notification(resource, owner, itip_event, success=True): message_text = owner_notification_text(resource, owner, itip_event['xml'], success) - msg = MIMEText(utils.stripped_message(message_text)) + msg = MIMEText(utils.stripped_message(message_text), _charset='utf-8') msg['To'] = owner['mail'] msg['From'] = resource['mail'] msg['Date'] = formatdate(localtime=True) - msg['Subject'] = _('Booking for %s has been %s') % (resource['cn'], participant_status_label(status) if success else _('failed')) + msg['Subject'] = utils.str2unicode(_('Booking for %s has been %s') % ( + resource['cn'], participant_status_label(status) if success else _('failed') + )) smtp = smtplib.SMTP("localhost", 10027) |