[CalendarServer-changes] [5750] CalendarServer/branches/new-store

source_changes at macosforge.org source_changes at macosforge.org
Tue Jun 15 18:40:51 PDT 2010


Revision: 5750
          http://trac.macosforge.org/projects/calendarserver/changeset/5750
Author:   glyph at apple.com
Date:     2010-06-15 18:40:46 -0700 (Tue, 15 Jun 2010)
Log Message:
-----------
some accounting for free/busy

Modified Paths:
--------------
    CalendarServer/branches/new-store/twistedcaldav/schedule.py
    CalendarServer/branches/new-store/txcaldav/calendarstore/file.py

Modified: CalendarServer/branches/new-store/twistedcaldav/schedule.py
===================================================================
--- CalendarServer/branches/new-store/twistedcaldav/schedule.py	2010-06-16 01:15:38 UTC (rev 5749)
+++ CalendarServer/branches/new-store/twistedcaldav/schedule.py	2010-06-16 01:40:46 UTC (rev 5750)
@@ -1,5 +1,6 @@
+# -*- test-case-name: twistedcaldav.directory.test.test_calendar -*-
 ##
-# Copyright (c) 2005-2007 Apple Inc. All rights reserved.
+# Copyright (c) 2005-2010 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.
@@ -36,7 +37,10 @@
 from twext.web2.http_headers import MimeType
 
 from twistedcaldav import caldavxml
-from twistedcaldav.caldavxml import caldav_namespace
+from twext.web2.dav.element.rfc2518 import HRef
+from txdav.propertystore.base import PropertyName
+from twistedcaldav.caldavxml import caldav_namespace, Opaque,\
+    CalendarFreeBusySet, ScheduleCalendarTransp
 from twistedcaldav.config import config
 from twistedcaldav.customxml import calendarserver_namespace
 from twistedcaldav.resource import CalDAVResource
@@ -122,7 +126,13 @@
         if qname == (caldav_namespace, "calendar-free-busy-set"):
             # Always return at least an empty list
             if not self.hasDeadProperty(property):
-                returnValue(caldavxml.CalendarFreeBusySet())
+                top = self.parent.url()
+                values = []
+                for cal in self.parent._newStoreCalendarHome.calendars():
+                    prop = cal.properties().get(PropertyName.fromString(ScheduleCalendarTransp.sname())) 
+                    if prop is None or prop == ScheduleCalendarTransp(Opaque()):
+                        values.append(HRef(joinURL(top, cal.name())))
+                returnValue(CalendarFreeBusySet(*values))
         elif qname == (caldav_namespace, "schedule-default-calendar-URL"):
             # Must have a valid default
             try:

Modified: CalendarServer/branches/new-store/txcaldav/calendarstore/file.py
===================================================================
--- CalendarServer/branches/new-store/txcaldav/calendarstore/file.py	2010-06-16 01:15:38 UTC (rev 5749)
+++ CalendarServer/branches/new-store/txcaldav/calendarstore/file.py	2010-06-16 01:40:46 UTC (rev 5750)
@@ -43,6 +43,7 @@
 
 from txdav.propertystore.xattr import PropertyStore
 from txdav.propertystore.base import PropertyName
+PN = PropertyName.fromString
 
 from txcaldav.icalendarstore import ICalendarStoreTransaction
 from txcaldav.icalendarstore import ICalendarStore, ICalendarHome
@@ -56,7 +57,7 @@
 from txcaldav.icalendarstore import InvalidCalendarComponentError
 from txcaldav.icalendarstore import InternalDataStoreError
 
-from twistedcaldav.caldavxml import ScheduleCalendarTransp, Transparent
+from twistedcaldav.caldavxml import ScheduleCalendarTransp, Transparent, Opaque
 from twistedcaldav.customxml import GETCTag
 
 from twistedcaldav.index import Index as OldIndex, IndexSchedule as OldInboxIndex
@@ -291,6 +292,10 @@
         self._calendarHomes[(uid, self)] = calendarHome
         if creating:
             calendarHome.createCalendarWithName("calendar")
+            defaultCal = calendarHome.calendarWithName("calendar")
+            props = defaultCal.properties()
+            props[PN(ScheduleCalendarTransp.sname())] = ScheduleCalendarTransp(
+                Opaque())
             calendarHome.createCalendarWithName("inbox")
         return calendarHome
 
@@ -381,7 +386,6 @@
 
         self._transaction.addOperation(do, "create calendar %r" % (name,))
         props = c.properties()
-        PN = PropertyName.fromString
         CalendarType = ResourceType.calendar #@UndefinedVariable
         props[PN(ResourceType.sname())] = CalendarType
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100615/90d86688/attachment.html>


More information about the calendarserver-changes mailing list