[CalendarServer-changes] [4795] CalendarServer/branches/release/CalendarServer-2.4-dev

source_changes at macosforge.org source_changes at macosforge.org
Fri Nov 20 15:39:05 PST 2009


Revision: 4795
          http://trac.macosforge.org/projects/calendarserver/changeset/4795
Author:   glyph at apple.com
Date:     2009-11-20 15:39:04 -0800 (Fri, 20 Nov 2009)
Log Message:
-----------
Pulled up r4782 from trunk.

Revision Links:
--------------
    http://trac.macosforge.org/projects/calendarserver/changeset/4782

Modified Paths:
--------------
    CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/scheduling/imip.py

Added Paths:
-----------
    CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/scheduling/test/test_imip.py

Property Changed:
----------------
    CalendarServer/branches/release/CalendarServer-2.4-dev/


Property changes on: CalendarServer/branches/release/CalendarServer-2.4-dev
___________________________________________________________________
Modified: svn:mergeinfo
   - /CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
/CalendarServer/trunk:4439-4440,4448,4450,4464,4473-4475,4602,4711-4712,4716-4717,4722,4739-4742,4748-4752,4758,4760,4762,4773,4784,4787
   + /CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
/CalendarServer/trunk:4439-4440,4448,4450,4464,4473-4475,4602,4711-4712,4716-4717,4722,4739-4742,4748-4752,4758,4760,4762,4773,4782,4784,4787

Modified: CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/scheduling/imip.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/scheduling/imip.py	2009-11-20 23:35:23 UTC (rev 4794)
+++ CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/scheduling/imip.py	2009-11-20 23:39:04 UTC (rev 4795)
@@ -14,7 +14,7 @@
 # limitations under the License.
 ##
 
-from twisted.internet.defer import inlineCallbacks
+from twisted.internet.defer import inlineCallbacks, returnValue
 
 from twisted.python.failure import Failure
 
@@ -56,6 +56,20 @@
             if self.freebusy:
                 raise ValueError("iMIP VFREEBUSY REQUESTs not supported.")
 
+            method = self.scheduler.calendar.propertyValue("METHOD") 
+            if method not in (
+                "PUBLISH",
+                "REQUEST",
+                "ADD",
+                "CANCEL",
+                "DECLINE_COUNTER",
+            ):
+                log.info("Could not do server-to-imip method: %s" % (method,))
+                for recipient in self.recipients:
+                    err = HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "recipient-failed")))
+                    self.responses.add(recipient.cuaddr, Failure(exc_value=err), reqstatus=iTIPRequestStatus.NO_USER_SUPPORT)
+                returnValue(None)
+
             caldata = str(self.scheduler.calendar)
 
             for recipient in self.recipients:

Copied: CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/scheduling/test/test_imip.py (from rev 4782, CalendarServer/trunk/twistedcaldav/scheduling/test/test_imip.py)
===================================================================
--- CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/scheduling/test/test_imip.py	                        (rev 0)
+++ CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/scheduling/test/test_imip.py	2009-11-20 23:39:04 UTC (rev 4795)
@@ -0,0 +1,90 @@
+##
+# Copyright (c) 2005-2007 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+from twisted.internet.defer import inlineCallbacks
+from twisted.web2 import responsecode
+from twistedcaldav.ical import Component
+from twistedcaldav.scheduling.cuaddress import RemoteCalendarUser
+from twistedcaldav.scheduling.imip import ScheduleViaIMip
+from twistedcaldav.scheduling.itip import iTIPRequestStatus
+from twistedcaldav.scheduling.scheduler import ScheduleResponseQueue
+import twistedcaldav.test.util
+
+class iMIPProcessing (twistedcaldav.test.util.TestCase):
+    """
+    iCalendar support tests
+    """
+
+    class FakeSchedule(object):
+        
+        def __init__(self, calendar):
+            self.calendar = calendar
+
+    @inlineCallbacks
+    def test_no_reply(self):
+        
+        data = """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:REPLY
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ORGANIZER;CN="User 01":mailto:user1 at example.com
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE:mailto:user2 at example.com
+END:VEVENT
+END:VCALENDAR
+"""
+
+        scheduler = iMIPProcessing.FakeSchedule(Component.fromString(data))
+        recipients = (RemoteCalendarUser("mailto:user1 at example.com"),)
+        responses = ScheduleResponseQueue("REPLY", responsecode.OK)
+
+        delivery = ScheduleViaIMip(scheduler, recipients, responses, False)
+        yield delivery.generateSchedulingResponses()
+        
+        self.assertEqual(len(responses.responses), 1)
+        self.assertEqual(str(responses.responses[0].children[1]), iTIPRequestStatus.NO_USER_SUPPORT)
+
+    @inlineCallbacks
+    def test_no_freebusy(self):
+        
+        data = """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:REQUEST
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VFREEBUSY
+UID:12345-67890
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ORGANIZER;CN="User 01":mailto:user1 at example.com
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE:mailto:user2 at example.com
+END:VFREEBUSY
+END:VCALENDAR
+"""
+
+        scheduler = iMIPProcessing.FakeSchedule(Component.fromString(data))
+        recipients = (RemoteCalendarUser("mailto:user1 at example.com"),)
+        responses = ScheduleResponseQueue("REQUEST", responsecode.OK)
+
+        delivery = ScheduleViaIMip(scheduler, recipients, responses, True)
+        yield delivery.generateSchedulingResponses()
+        
+        self.assertEqual(len(responses.responses), 1)
+        self.assertEqual(str(responses.responses[0].children[1]), iTIPRequestStatus.SERVICE_UNAVAILABLE)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20091120/5fef4b0d/attachment-0001.html>


More information about the calendarserver-changes mailing list