[CalendarServer-changes] [9706] CalendarServer/branches/users/gaya/inviteclean/txdav/common/ datastore/sql.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Aug 14 14:40:20 PDT 2012


Revision: 9706
          http://trac.macosforge.org/projects/calendarserver/changeset/9706
Author:   gaya at apple.com
Date:     2012-08-14 14:40:20 -0700 (Tue, 14 Aug 2012)
Log Message:
-----------
Comment out unneeded PropertyStore.load() from CommonHomeChild.shareWith and CommonHomeChild.updateShare(). (May re-add code when CommonHomeChild.setSharingUID() is removed.)

Modified Paths:
--------------
    CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py

Modified: CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py	2012-08-14 21:37:20 UTC (rev 9705)
+++ CalendarServer/branches/users/gaya/inviteclean/txdav/common/datastore/sql.py	2012-08-14 21:40:20 UTC (rev 9706)
@@ -82,7 +82,7 @@
 from twistedcaldav.customxml import NotificationType
 from twistedcaldav.dateops import datetimeMktime, parseSQLTimestamp,\
     pyCalendarTodatetime
-from txdav.xml.rfc2518 import DisplayName
+#from txdav.xml.rfc2518 import DisplayName
 
 from txdav.base.datastore.util import normalizeUUIDOrNot
 
@@ -2149,13 +2149,16 @@
                 resourceID=self._resourceID, homeID=shareeHome._resourceID
             ))[0][0]
         
-        shareeProps = yield PropertyStore.load(shareeHome.uid(), self._txn,
-                                               self._resourceID)
-        dn = PropertyName.fromElement(DisplayName)
-        dnprop = (self.properties().get(dn) or
-                  DisplayName.fromString(self.name()))
-
-        shareeProps[dn] = dnprop
+        ''' Only needed when setSharingUID is removed
+        if status == _BIND_STATUS_ACCEPTED:
+            shareeProps = yield PropertyStore.load(self._home.uid(), self._txn,
+                                                   self._resourceID)
+            dn = PropertyName.fromElement(DisplayName)
+            dnprop = (self.properties().get(dn) or
+                      DisplayName.fromString(self.name()))
+    
+            shareeProps[dn] = dnprop
+        '''
         
         # Must send notification to ensure cache invalidation occurs
         yield self.notifyChanged()
@@ -2204,22 +2207,11 @@
                                 
         if len(columnMap):
 
-            dn = PropertyName.fromElement(DisplayName)
-            dnprop = (self.properties().get(dn) or
-                      DisplayName.fromString(self.name()))
-            
             sharedname = yield self._updateBindColumnsQuery(columnMap).on(
                             self._txn,
                             resourceID=self._resourceID, homeID=shareeView._home._resourceID
                         )
-    
-            shareeProps = yield PropertyStore.load(shareeView._home.uid(), self._txn,
-                                                   self._resourceID)
-            shareeProps[dn] = dnprop
             
-            # Must send notification to ensure cache invalidation occurs
-            yield self.notifyChanged()
-            
             #update affected attributes
             if mode:
                 shareeView._bindMode = columnMap[bind.BIND_MODE]
@@ -2229,6 +2221,18 @@
                 #TODO: Is is OK to always call _initSyncToken ?
                 if shareeView._bindStatus == _BIND_STATUS_ACCEPTED:
                     yield shareeView._initSyncToken()
+            
+                    ''' Only needed when setSharingUID is removed
+
+                    shareeProps = yield PropertyStore.load(self._home.uid(), self._txn,
+                                                           self._resourceID)
+                    dn = PropertyName.fromElement(DisplayName)
+                    dnprop = (self.properties().get(dn) or
+                              DisplayName.fromString(self.name()))
+            
+                    shareeProps[dn] = dnprop
+                    '''
+
                 elif shareeView._bindStatus == _BIND_STATUS_DECLINED:
                     shareeView._deletedSyncToken(sharedRemoval=True);
 
@@ -2236,7 +2240,10 @@
                 shareeView._bindMessage = columnMap[bind.MESSAGE]
             
             shareeView._name = sharedname[0][0]
-        
+
+            # Must send notification to ensure cache invalidation occurs
+            yield self.notifyChanged()
+                    
         returnValue(shareeView._name)
         
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120814/63f78b36/attachment.html>


More information about the calendarserver-changes mailing list