[CalendarServer-changes] [6305] CalendarServer/trunk/txdav

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 16 11:14:07 PDT 2010


Revision: 6305
          http://trac.macosforge.org/projects/calendarserver/changeset/6305
Author:   cdaboo at apple.com
Date:     2010-09-16 11:14:07 -0700 (Thu, 16 Sep 2010)
Log Message:
-----------
Fix delete calendar push to push the calendar node and home node.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/test/common.py
    CalendarServer/trunk/txdav/carddav/datastore/test/common.py
    CalendarServer/trunk/txdav/common/datastore/file.py
    CalendarServer/trunk/txdav/common/datastore/sql.py

Modified: CalendarServer/trunk/txdav/caldav/datastore/test/common.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/common.py	2010-09-16 17:22:21 UTC (rev 6304)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/common.py	2010-09-16 18:14:07 UTC (rev 6305)
@@ -506,8 +506,11 @@
             self.notifierFactory.history,
             [
                 ("update", "CalDAV|home1"),
+                ("update", "CalDAV|home1/calendar_1"),
                 ("update", "CalDAV|home1"),
-                ("update", "CalDAV|home1")
+                ("update", "CalDAV|home1/calendar_2"),
+                ("update", "CalDAV|home1"),
+                ("update", "CalDAV|home1/calendar_empty"),
             ]
         )
 

Modified: CalendarServer/trunk/txdav/carddav/datastore/test/common.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/test/common.py	2010-09-16 17:22:21 UTC (rev 6304)
+++ CalendarServer/trunk/txdav/carddav/datastore/test/common.py	2010-09-16 18:14:07 UTC (rev 6305)
@@ -406,8 +406,11 @@
             self.notifierFactory.history,
             [
                 ("update", "CardDAV|home1"),
+                ("update", "CardDAV|home1/addressbook_1"),
                 ("update", "CardDAV|home1"),
-                ("update", "CardDAV|home1")
+                ("update", "CardDAV|home1/addressbook_2"),
+                ("update", "CardDAV|home1"),
+                ("update", "CardDAV|home1/addressbook_empty")
             ]
         )
 

Modified: CalendarServer/trunk/txdav/common/datastore/file.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/file.py	2010-09-16 17:22:21 UTC (rev 6304)
+++ CalendarServer/trunk/txdav/common/datastore/file.py	2010-09-16 18:14:07 UTC (rev 6305)
@@ -464,10 +464,11 @@
         if name.startswith(".") or name in self._removedChildren:
             raise NoSuchHomeChildError(name)
 
+        child = self.childWithName(name)
+        if not child:
+            raise NoSuchHomeChildError()
+
         self._removedChildren.add(name)
-        childPath = self._path.child(name)
-        if name not in self._newChildren and not childPath.isdir():
-            raise NoSuchHomeChildError(name)
 
         def do(transaction=self._transaction):
             childPath = self._path.child(name)
@@ -502,7 +503,7 @@
             do, "prepare child remove %r" % (name,)
         )
 
-        self.notifyChanged()
+        child.notifyChanged()
 
     # @cached
     def properties(self):

Modified: CalendarServer/trunk/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql.py	2010-09-16 17:22:21 UTC (rev 6304)
+++ CalendarServer/trunk/txdav/common/datastore/sql.py	2010-09-16 18:14:07 UTC (rev 6305)
@@ -422,25 +422,22 @@
 
 
     def removeChildWithName(self, name):
-        rows = self._txn.execSQL(
-            """select %(column_RESOURCE_ID)s from %(name)s
-               where %(column_RESOURCE_NAME)s = %%s and %(column_HOME_RESOURCE_ID)s = %%s""" % self._bindTable,
-            [name, self._resourceID]
-        )
-        if not rows:
+        
+        child = self.childWithName(name)
+        if not child:
             raise NoSuchHomeChildError()
-        resourceID = rows[0][0]
 
         self._txn.execSQL(
             "delete from %(name)s where %(column_RESOURCE_ID)s = %%s" % self._childTable,
-            [resourceID]
+            [child._resourceID]
         )
         self._children.pop(name, None)
         if self._txn._cursor.rowcount == 0:
             raise NoSuchHomeChildError()
-        self.notifyChanged()
 
+        child.notifyChanged()
 
+
     @cached
     def properties(self):
         return PropertyStore(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100916/94ea5f0d/attachment-0001.html>


More information about the calendarserver-changes mailing list