[CalendarServer-changes] [282] CalendarServer/trunk/twistedcaldav/resource.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Oct 20 08:17:43 PDT 2006


Revision: 282
          http://trac.macosforge.org/projects/calendarserver/changeset/282
Author:   cdaboo at apple.com
Date:     2006-10-20 08:17:42 -0700 (Fri, 20 Oct 2006)

Log Message:
-----------
Use locateResource for principal collections to ensure their URIs get recorded in the request.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/resource.py

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2006-10-19 20:19:10 UTC (rev 281)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2006-10-20 15:17:42 UTC (rev 282)
@@ -409,7 +409,7 @@
     """
     # Use a WeakKeyDictionary to keep track of all instances.
     # A WeakKeySet would be more appropriate, but there is no such class yet.
-    _principleCollectionSet = WeakValueDictionary()
+    _principleCollectionSet = set()
 
     @classmethod
     def outboxForCalendarUser(clazz, request, address):
@@ -456,7 +456,7 @@
 
         # Register self with class
         if url not in CalendarPrincipalCollectionResource._principleCollectionSet:
-            CalendarPrincipalCollectionResource._principleCollectionSet[url] = self
+            CalendarPrincipalCollectionResource._principleCollectionSet.add(url)
 
     def isCollection(self):
         return True
@@ -513,9 +513,11 @@
     @return: the L{CalendarPrincipalResource} for the specified calendar
         user, or C{None} if the user is not found.
     """
-    for url in CalendarPrincipalCollectionResource._principleCollectionSet.keys():
+    for url in CalendarPrincipalCollectionResource._principleCollectionSet:
         try:
-            pcollection = CalendarPrincipalCollectionResource._principleCollectionSet[url]
+            pcollection = waitForDeferred(request.locateResource(url))
+            yield pcollection
+            pcollection = pcollection.getResult()
             if isinstance(pcollection, CalendarPrincipalCollectionResource):
                 principal = waitForDeferred(pcollection.findCalendarUser(request, address))
                 yield principal

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061020/1b924c39/attachment.html


More information about the calendarserver-changes mailing list