[CalendarServer-changes] [8007] CalendarServer/trunk/twistedcaldav/mail.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Aug 22 21:45:23 PDT 2011


Revision: 8007
          http://trac.macosforge.org/projects/calendarserver/changeset/8007
Author:   glyph at apple.com
Date:     2011-08-22 21:45:22 -0700 (Mon, 22 Aug 2011)
Log Message:
-----------
To work around http://bugs.python.org/issue1368247 (which still exists in some versions of Python we support), encode plain text as bytes before giving it to MIMEText.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/mail.py

Modified: CalendarServer/trunk/twistedcaldav/mail.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/mail.py	2011-08-23 02:53:33 UTC (rev 8006)
+++ CalendarServer/trunk/twistedcaldav/mail.py	2011-08-23 04:45:22 UTC (rev 8007)
@@ -1407,6 +1407,10 @@
         """
         Render text/plain message part based on invitation details and a flag
         indicating whether the message is a cancellation.
+
+        @return: UTF-8 encoded text.
+
+        @rtype: C{str}
         """
         plainAttendeeList = []
         for cn, mailto in attendees:
@@ -1427,7 +1431,7 @@
         else:
             plainTemplate = plainInviteTemplate
 
-        return plainTemplate % details
+        return (plainTemplate % details).encode("UTF-8")
 
 
     def renderHTML(self, details, organizer, attendees, canceled):
@@ -1435,9 +1439,10 @@
         Render HTML message part based on invitation details and a flag
         indicating whether the message is a cancellation.
 
-        @return: a 2-tuple of (should add icon (C{bool}), html text (C{str})).
-            The first element indicates whether the MIME generator needs to add
-            a L{cid:} icon image part to satisfy the HTML links.
+        @return: a 2-tuple of (should add icon (C{bool}), html text (C{str},
+            representing utf-8 encoded bytes)).  The first element indicates
+            whether the MIME generator needs to add a L{cid:} icon image part to
+            satisfy the HTML links.
         """
         orgCN, orgEmail = organizer
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110822/ef926303/attachment.html>


More information about the calendarserver-changes mailing list