[CalendarServer-changes] [2782] CalendarServer/branches/users/cdaboo/implicit-2660/twistedcaldav/ schedule.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Aug 7 08:25:04 PDT 2008


Revision: 2782
          http://trac.macosforge.org/projects/calendarserver/changeset/2782
Author:   cdaboo at apple.com
Date:     2008-08-07 08:25:04 -0700 (Thu, 07 Aug 2008)
Log Message:
-----------
Handle logic for getting/setting CALDAV:schedule-default-calendar-URL property.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/implicit-2660/twistedcaldav/schedule.py

Modified: CalendarServer/branches/users/cdaboo/implicit-2660/twistedcaldav/schedule.py
===================================================================
--- CalendarServer/branches/users/cdaboo/implicit-2660/twistedcaldav/schedule.py	2008-08-07 15:22:06 UTC (rev 2781)
+++ CalendarServer/branches/users/cdaboo/implicit-2660/twistedcaldav/schedule.py	2008-08-07 15:25:04 UTC (rev 2782)
@@ -83,6 +83,7 @@
 
     liveProperties = CalendarSchedulingCollectionResource.liveProperties + (
         (caldav_namespace, "calendar-free-busy-set"),
+        (caldav_namespace, "schedule-default-calendar-URL"),
     )
 
     def resourceType(self):
@@ -109,6 +110,10 @@
             # Always return at least an empty list
             if not self.hasDeadProperty(property):
                 return succeed(caldavxml.CalendarFreeBusySet())
+        elif qname == (caldav_namespace, "schedule-default-calendar-URL"):
+            # Always return at least an empty item
+            if not self.hasDeadProperty(property):
+                return succeed(caldavxml.ScheduleDefaultCalendarURL())
             
         return super(ScheduleInboxResource, self).readProperty(property, request)
 
@@ -145,6 +150,18 @@
                         (caldav_namespace, "valid-calendar-url")
                     ))
 
+        elif property.qname() == (caldav_namespace, "schedule-default-calendar-URL"):
+            # Verify that the calendar added in the PROPPATCH is valid.
+            new_calendar = [str(href) for href in property.children]
+            if len(new_calendar) == 1:
+                cal = (yield request.locateResource(str(new_calendar[0])))
+                if cal is None or not cal.exists() or not isCalendarCollectionResource(cal):
+                    # Validate that href's point to a valid calendar.
+                    raise HTTPError(ErrorResponse(
+                        responsecode.CONFLICT,
+                        (caldav_namespace, "valid-calendar-url")
+                    ))
+
         yield super(ScheduleInboxResource, self).writeProperty(property, request)
 
 class ScheduleOutboxResource (CalendarSchedulingCollectionResource):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080807/66242f87/attachment-0001.html 


More information about the calendarserver-changes mailing list