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

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 17 12:17:25 PST 2011


Revision: 7034
          http://trac.macosforge.org/projects/calendarserver/changeset/7034
Author:   cdaboo at apple.com
Date:     2011-02-17 12:17:23 -0800 (Thu, 17 Feb 2011)
Log Message:
-----------
Tweak to avoid an SQL query for the more common case of looking up a non-shared calendar.

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

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2011-02-17 17:42:29 UTC (rev 7033)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2011-02-17 20:17:23 UTC (rev 7034)
@@ -2103,16 +2103,18 @@
             self.putChild(name, child)
             returnValue(child)
 
-        # Try shares next
-        if self.canShare():
-            child = yield self.provisionShare(name)
-            if child:
-                returnValue(child)
+        # Try normal child type
+        child = (yield self.makeRegularChild(name))
 
-        # Do normal child types
-        returnValue((yield self.makeRegularChild(name)))
+        # Try shares next if child does not exist
+        if not child.exists() and self.canShare():
+            sharedchild = yield self.provisionShare(name)
+            if sharedchild:
+                returnValue(sharedchild)
 
+        returnValue(child)
 
+
     @inlineCallbacks
     def createNotificationsCollection(self):
         txn = self._associatedTransaction
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110217/c497296b/attachment.html>


More information about the calendarserver-changes mailing list