[CalendarServer-changes] [13828] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Sat Aug 2 13:42:19 PDT 2014
Revision: 13828
http://trac.calendarserver.org//changeset/13828
Author: cdaboo at apple.com
Date: 2014-08-02 13:42:19 -0700 (Sat, 02 Aug 2014)
Log Message:
-----------
Hook up principal and data collection resources at the app layer without involving the directory service.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tap/util.py
CalendarServer/trunk/twistedcaldav/directory/addressbook.py
CalendarServer/trunk/twistedcaldav/directory/calendar.py
CalendarServer/trunk/twistedcaldav/directory/principal.py
Modified: CalendarServer/trunk/calendarserver/tap/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/util.py 2014-08-02 19:40:39 UTC (rev 13827)
+++ CalendarServer/trunk/calendarserver/tap/util.py 2014-08-02 20:42:19 UTC (rev 13828)
@@ -442,8 +442,6 @@
#
log.info("Setting up document root at: {root}", root=config.DocumentRoot)
- # principalCollection = directory.principalCollection
-
if config.EnableCalDAV:
log.info("Setting up calendar collection: {cls}", cls=calendarResourceClass)
calendarCollection = calendarResourceClass(
@@ -451,6 +449,7 @@
"/calendars/",
newStore,
)
+ principalCollection.calendarCollection = calendarCollection
if config.EnableCardDAV:
log.info("Setting up address book collection: {cls}", cls=addressBookResourceClass)
@@ -459,6 +458,7 @@
"/addressbooks/",
newStore,
)
+ principalCollection.addressBookCollection = addressBookCollection
if config.DirectoryAddressBook.Enabled and config.EnableSearchAddressBook:
log.info(
Modified: CalendarServer/trunk/twistedcaldav/directory/addressbook.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/addressbook.py 2014-08-02 19:40:39 UTC (rev 13827)
+++ CalendarServer/trunk/twistedcaldav/directory/addressbook.py 2014-08-02 20:42:19 UTC (rev 13828)
@@ -97,9 +97,6 @@
self._url = url
self._newStore = store
- # FIXME: Smells like a hack
- directory.addressBookHomesCollection = self
-
#
# Create children
#
Modified: CalendarServer/trunk/twistedcaldav/directory/calendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/calendar.py 2014-08-02 19:40:39 UTC (rev 13827)
+++ CalendarServer/trunk/twistedcaldav/directory/calendar.py 2014-08-02 20:42:19 UTC (rev 13828)
@@ -98,9 +98,6 @@
self._url = url
self._newStore = store
- # FIXME: Smells like a hack
- directory.calendarHomesCollection = self
-
#
# Create children
#
Modified: CalendarServer/trunk/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/principal.py 2014-08-02 19:40:39 UTC (rev 13827)
+++ CalendarServer/trunk/twistedcaldav/directory/principal.py 2014-08-02 20:42:19 UTC (rev 13828)
@@ -286,6 +286,10 @@
# FIXME: Smells like a hack
self.directory.setPrincipalCollection(self)
+ # Used to hook in the data collection root resources
+ self.calendarCollection = None
+ self.addressBookCollection = None
+
#
# Create children
#
@@ -1349,10 +1353,10 @@
def _homeChildURL(self, name):
if not hasattr(self, "calendarHomeURL"):
- if not hasattr(self.record.service, "calendarHomesCollection"):
+ if self.parent.parent.calendarCollection is None:
return None
self.calendarHomeURL = joinURL(
- self.record.service.calendarHomesCollection.url(),
+ self.parent.parent.calendarCollection.url(),
uidsResourceName,
self.record.uid
) + "/"
@@ -1369,20 +1373,18 @@
def calendarHome(self, request):
- # FIXME: self.record.service.calendarHomesCollection smells like a hack
- service = self.record.service
- if hasattr(service, "calendarHomesCollection"):
- return service.calendarHomesCollection.homeForDirectoryRecord(self.record, request)
+ if self.parent.parent.calendarCollection is not None:
+ return self.parent.parent.calendarCollection.homeForDirectoryRecord(self.record, request)
else:
return succeed(None)
def _addressBookHomeChildURL(self, name):
if not hasattr(self, "addressBookHomeURL"):
- if not hasattr(self.record.service, "addressBookHomesCollection"):
+ if self.parent.parent.addressBookCollection is None:
return None
self.addressBookHomeURL = joinURL(
- self.record.service.addressBookHomesCollection.url(),
+ self.parent.parent.addressBookCollection.url(),
uidsResourceName,
self.record.uid
) + "/"
@@ -1399,10 +1401,8 @@
def addressBookHome(self, request):
- # FIXME: self.record.service.addressBookHomesCollection smells like a hack
- service = self.record.service
- if hasattr(service, "addressBookHomesCollection"):
- return service.addressBookHomesCollection.homeForDirectoryRecord(self.record, request)
+ if self.parent.parent.addressBookCollection is not None:
+ return self.parent.parent.addressBookCollection.homeForDirectoryRecord(self.record, request)
else:
return succeed(None)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140802/353cac1a/attachment-0001.html>
More information about the calendarserver-changes
mailing list