Revision: 845 http://trac.macosforge.org/projects/calendarserver/changeset/845 Author: wsanchez@apple.com Date: 2006-12-15 19:48:58 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Call provisionDefaultCalendars() from parent for now Modified Paths: -------------- CalendarServer/trunk/twistedcaldav/directory/calendar.py CalendarServer/trunk/twistedcaldav/static.py Modified: CalendarServer/trunk/twistedcaldav/directory/calendar.py =================================================================== --- CalendarServer/trunk/twistedcaldav/directory/calendar.py 2006-12-16 03:20:11 UTC (rev 844) +++ CalendarServer/trunk/twistedcaldav/directory/calendar.py 2006-12-16 03:48:58 UTC (rev 845) @@ -192,23 +192,14 @@ assert isinstance(child, cls), "Child %r is not a %s: %r" % (name, cls.__name__, child) self.putChild(name, child) - def provision(self): - # FIXME: Make sure we don't do this more than once. - d = self.provisionDefaultCalendars() - d.addCallback(lambda _: super(DirectoryCalendarHomeResource, self).provision()) - return d - def provisionDefaultCalendars(self): - # Create a calendar collection + self.provision() childName = "calendar" childURL = joinURL(self.url(), childName) child = self.provisionChild(childName) assert isinstance(child, CalDAVResource), "Child %r is not a %s: %r" % (childName, CalDAVResource.__name__, child) - if child.exists(): - return succeed(None) - def setupChild(_): # Grant read-free-busy access to authenticated users child.setAccessControlList( @@ -230,6 +221,8 @@ inbox.provision() inbox.writeDeadProperty(caldavxml.CalendarFreeBusySet(davxml.HRef(childURL))) + return self + d = child.createCalendarCollection() d.addCallback(setupChild) return d Modified: CalendarServer/trunk/twistedcaldav/static.py =================================================================== --- CalendarServer/trunk/twistedcaldav/static.py 2006-12-16 03:20:11 UTC (rev 844) +++ CalendarServer/trunk/twistedcaldav/static.py 2006-12-16 03:48:58 UTC (rev 845) @@ -421,7 +421,10 @@ DirectoryCalendarHomeTypeProvisioningResource.__init__(self, parent, recordType) def provisionChild(self, record): - return CalendarHomeFile(self.fp.child(record.shortName).path, self, record) + child = CalendarHomeFile(self.fp.child(record.shortName).path, self, record) + if not child.exists(): + return child.provisionDefaultCalendars() + return child def createSimilarFile(self, path): raise HTTPError(responsecode.NOT_FOUND)
participants (1)
-
source_changes@macosforge.org