Revision
835
Author
wsanchez@apple.com
Date
2006-12-14 22:12:30 -0800 (Thu, 14 Dec 2006)

Log Message

Do not call provision() on your children when provisioning yourself;
this obviates the whole lazy-provisioning strategy.

Modified Paths

Diff

Modified: CalendarServer/trunk/twistedcaldav/directory/calendar.py (834 => 835)


--- CalendarServer/trunk/twistedcaldav/directory/calendar.py	2006-12-15 05:03:02 UTC (rev 834)
+++ CalendarServer/trunk/twistedcaldav/directory/calendar.py	2006-12-15 06:12:30 UTC (rev 835)
@@ -188,9 +188,9 @@
             ("outbox", ScheduleOutboxResource),
         )
         if config.DropBoxEnabled:
-            childlist = childlist + (
-                ("dropbox",       DropBoxHomeResource),
-                #("notifications": NotificationsHomeResource),
+            childlist += (
+                ("dropbox"      , DropBoxHomeResource      ),
+               #("notifications", NotificationsHomeResource),
             )
         for name, cls in childlist:
             child = self.provisionChild(name)
@@ -198,20 +198,9 @@
             self.putChild(name, child)
 
     def provision(self):
-        self.provisionSpecialCollections()
+        # FIXME: Make sure we don't do this more than once.
         return self.provisionDefaultCalendars()
 
-    def provisionSpecialCollections(self):
-        childlist = ("inbox" , "outbox",)
-        if config.DropBoxEnabled:
-            childlist = childlist + (
-                "dropbox",
-                #"notifications",
-            )
-        for child in childlist:
-            collection = self.getChild(child)
-            collection.provision()
-
     def provisionDefaultCalendars(self):
         # Create a calendar collection
 
@@ -234,6 +223,11 @@
 
             # Set calendar-free-busy-set on inbox
             inbox = self.getChild("inbox")
+            # FIXME: Shouldn't have to call provision() on another resource
+            # We cheat here because while inbox will auto-provision itself when located,
+            # we need to write a dead property to it pre-emptively.
+            # Possible fix: store the free/busy set property on this resource instead.
+            inbox.provision()
             inbox.writeDeadProperty(caldavxml.CalendarFreeBusySet(davxml.HRef(childURL)))
 
         d = child.createCalendarCollection()