[CalendarServer-changes] [610] CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/ directory/principal.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Nov 27 20:06:54 PST 2006


Revision: 610
          http://trac.macosforge.org/projects/calendarserver/changeset/610
Author:   wsanchez at apple.com
Date:     2006-11-27 20:06:53 -0800 (Mon, 27 Nov 2006)

Log Message:
-----------
Fix calendarHomeURLs() to deal with no calendar home collection.
Same for scheduleInboxURL() and scheduleOutboxURL().

Modified Paths:
--------------
    CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/principal.py

Modified: CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/principal.py	2006-11-28 03:18:06 UTC (rev 609)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/twistedcaldav/directory/principal.py	2006-11-28 04:06:53 UTC (rev 610)
@@ -304,14 +304,23 @@
         return (self.principalURL(),) + tuple(self.record.calendarUserAddresses)
 
     def calendarHomeURLs(self):
-        # FIXME: self.directory.calendarHomesCollection smells like a hack
+        # FIXME: self.record.service.calendarHomesCollection smells like a hack
         # See CalendarHomeProvisioningFile.__init__()
-        return (
-            self.record.service.calendarHomesCollection.homeForDirectoryRecord(self.record).url(),
-        )
+        service = self.record.service
+        if hasattr(service, "calendarHomesCollection"):
+            return (service.calendarHomesCollection.homeForDirectoryRecord(self.record).url(),)
+        else:
+            return ()
 
     def scheduleInboxURL(self):
-        return joinURL(self.calendarHomeURLs()[0], "inbox/")
+        return self._homeChildURL("inbox/")
 
     def scheduleOutboxURL(self):
-        return joinURL(self.calendarHomeURLs()[0], "outbox/")
+        return self._homeChildURL("outbox/")
+
+    def _homeChildURL(self, name):
+        homes = self.calendarHomeURLs()
+        if homes:
+            return joinURL(homes[0], name)
+        else:
+            return None

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061127/8811f7ac/attachment.html


More information about the calendarserver-changes mailing list