[CalendarServer-changes] [2893] CalendarServer/branches/users/sagen/mailgateway-2881/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 27 13:27:45 PDT 2008


Revision: 2893
          http://trac.macosforge.org/projects/calendarserver/changeset/2893
Author:   sagen at apple.com
Date:     2008-08-27 13:27:44 -0700 (Wed, 27 Aug 2008)
Log Message:
-----------
When a cancel is being sent out -- don't try to access event info such as summary or start time -- those aren't there.

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/mailgateway-2881/twistedcaldav/mail.py
    CalendarServer/branches/users/sagen/mailgateway-2881/twistedcaldav/test/test_mail.py

Modified: CalendarServer/branches/users/sagen/mailgateway-2881/twistedcaldav/mail.py
===================================================================
--- CalendarServer/branches/users/sagen/mailgateway-2881/twistedcaldav/mail.py	2008-08-27 19:54:38 UTC (rev 2892)
+++ CalendarServer/branches/users/sagen/mailgateway-2881/twistedcaldav/mail.py	2008-08-27 20:27:44 UTC (rev 2893)
@@ -674,7 +674,6 @@
         msg["Reply-To"] = "${replytoaddress}"
         msg["To"] = "${toaddress}"
         msg["Date"] = rfc822date()
-        msg["Subject"] = "Event invitation: %s" % (title,)
         msgId = messageid()
         msg["Message-ID"] = msgId
 
@@ -682,7 +681,13 @@
         msg.attach(msgAlt)
 
         # plain text version
-        plainText = u"You've been invited to the following event:  %s To accept or decline this invitation, click the link below.\n" % (summary,)
+        if calendar.propertyValue("METHOD") == "CANCEL":
+            msg["Subject"] = "Event cancelled"
+            plainText = u"An event has been cancelled.  Click the link below.\n"
+        else:
+            msg["Subject"] = "Event invitation: %s" % (title,)
+            plainText = u"You've been invited to the following event:  %s To accept or decline this invitation, click the link below.\n" % (summary,)
+
         msgPlain = MIMEText(plainText.encode("UTF-8"), "plain", "UTF-8")
         msgAlt.attach(msgPlain)
 
@@ -731,7 +736,10 @@
             organizer = "%s <%s>" % (organizerProp.params()["CN"][0],
                 organizer,)
 
-        dtinfo = self._getDateTimeInfo(component)
+        if calendar.propertyValue("METHOD") == "CANCEL":
+            dtinfo = ""
+        else:
+            dtinfo = self._getDateTimeInfo(component)
 
         summary = component.propertyValue("SUMMARY")
         if summary is None:

Modified: CalendarServer/branches/users/sagen/mailgateway-2881/twistedcaldav/test/test_mail.py
===================================================================
--- CalendarServer/branches/users/sagen/mailgateway-2881/twistedcaldav/test/test_mail.py	2008-08-27 19:54:38 UTC (rev 2892)
+++ CalendarServer/branches/users/sagen/mailgateway-2881/twistedcaldav/test/test_mail.py	2008-08-27 20:27:44 UTC (rev 2893)
@@ -87,7 +87,6 @@
         self.assertEquals(organizer, 'mailto:user01 at example.com')
         self.assertEquals(attendee, 'mailto:xyzzy at example.com')
         self.assertEquals(msgId, '<1983F777-BE86-4B98-881E-06D938E60920 at example.com>')
-        self.assertEquals(str(calendar), 'BEGIN:VCALENDAR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nMETHOD:REPLY\r\nPRODID:-//example Inc.//iCal 3.0//EN\r\nBEGIN:VTIMEZONE\r\nTZID:US/Pacific\r\nBEGIN:STANDARD\r\nDTSTART:20071104T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\r\nTZNAME:PST\r\nTZOFFSETFROM:-0700\r\nTZOFFSETTO:-0800\r\nEND:STANDARD\r\nBEGIN:DAYLIGHT\r\nDTSTART:20070311T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\r\nTZNAME:PDT\r\nTZOFFSETFROM:-0800\r\nTZOFFSETTO:-0700\r\nEND:DAYLIGHT\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nUID:1E71F9C8-AEDA-48EB-98D0-76E898F6BB5C\r\nDTSTART;TZID=US/Pacific:20080812T100000\r\nDTEND;TZID=US/Pacific:20080812T110000\r\nATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;CN=xyzzy at example.com;PARTS\r\n TAT=ACCEPTED:mailto:xyzzy at example.com\r\nCREATED:20080812T201906Z\r\nDTSTAMP:20080812T201911Z\r\nORGANIZER;CN=User 01:mailto:user01 at example.com\r\nSEQUENCE:7\r\nSUMMARY:New Event\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n')
 
 
 class MailGatewayTokensDatabaseTests(TestCase):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080827/a8fd4d6b/attachment.html 


More information about the calendarserver-changes mailing list