[CalendarServer-changes] [14633] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Mon Mar 30 09:19:37 PDT 2015


Revision: 14633
          http://trac.calendarserver.org//changeset/14633
Author:   sagen at apple.com
Date:     2015-03-30 09:19:36 -0700 (Mon, 30 Mar 2015)
Log Message:
-----------
Purge tool bypasses the trash

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/calverify.py
    CalendarServer/trunk/calendarserver/tools/purge.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/utils.py
    CalendarServer/trunk/txdav/caldav/datastore/sql.py
    CalendarServer/trunk/txdav/caldav/datastore/sql_external.py
    CalendarServer/trunk/txdav/caldav/datastore/test/common.py
    CalendarServer/trunk/txdav/caldav/datastore/test/test_attachments.py
    CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
    CalendarServer/trunk/txdav/carddav/datastore/sql.py
    CalendarServer/trunk/txdav/common/datastore/file.py
    CalendarServer/trunk/txdav/common/datastore/podding/migration/test/test_home_sync.py
    CalendarServer/trunk/txdav/common/datastore/sql.py
    CalendarServer/trunk/txdav/common/datastore/sql_external.py
    CalendarServer/trunk/txdav/common/datastore/sql_notification.py
    CalendarServer/trunk/txdav/common/datastore/test/util.py
    CalendarServer/trunk/txdav/common/datastore/work/test/test_inbox_cleanup.py

Modified: CalendarServer/trunk/calendarserver/tools/calverify.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/calverify.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/calendarserver/tools/calverify.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -739,7 +739,7 @@
             calendar = yield home.childWithID(calendarID)
             calendarObj = yield calendar.objectResourceWithID(resid)
             objname = calendarObj.name()
-            yield calendarObj.remove(implicitly=False)
+            yield calendarObj.remove(implicitly=False, bypassTrash=True)
             yield self.txn.commit()
             self.txn = self.store.newTransaction()
 

Modified: CalendarServer/trunk/calendarserver/tools/purge.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/purge.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/calendarserver/tools/purge.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -994,7 +994,7 @@
             yield storeCalHome.removeUnacceptedShares()
             notificationHome = yield txn.notificationsWithUID(storeCalHome.uid())
             if notificationHome is not None:
-                yield notificationHome.remove()
+                yield notificationHome.remove(bypassTrash=True)
 
 
     @inlineCallbacks
@@ -1059,7 +1059,7 @@
                     if not self.dryrun:
                         retry = False
                         try:
-                            yield childResource.remove(implicitly=doScheduling)
+                            yield childResource.remove(implicitly=doScheduling, bypassTrash=True)
                             incrementCount = True
                         except Exception, e:
                             print("Exception deleting %s: %s" % (uri, str(e)))
@@ -1069,7 +1069,7 @@
                             # Try again with implicit scheduling off
                             print("Retrying deletion of %s with scheduling turned off" % (uri,))
                             try:
-                                yield childResource.remove(implicitly=False)
+                                yield childResource.remove(implicitly=False, bypassTrash=True)
                                 incrementCount = True
                             except Exception, e:
                                 print("Still couldn't delete %s even with scheduling turned off: %s" % (uri, str(e)))
@@ -1099,6 +1099,7 @@
             storeCalHome = yield txn.calendarHomeWithUID(uid)
             if storeCalHome is not None:
                 calendars = list((yield storeCalHome.calendars()))
+                calendars.extend(list((yield storeCalHome.calendars(onlyInTrash=True))))
                 remainingCalendars = len(calendars)
                 for calColl in calendars:
                     if len(list((yield calColl.calendarObjects()))) == 0:
@@ -1111,7 +1112,7 @@
                                 print("Deleting calendar: %s" % (calendarName,))
                         if not self.dryrun:
                             if calColl.owned():
-                                yield storeCalHome.removeChildWithName(calendarName)
+                                yield storeCalHome.removeChildWithName(calendarName, bypassTrash=True)
                             else:
                                 yield calColl.unshare()
 
@@ -1178,7 +1179,7 @@
                     if not self.dryrun:
                         # Also remove the addressbook collection itself
                         if abColl.owned():
-                            yield storeAbHome.removeChildWithName(abName)
+                            yield storeAbHome.removeChildWithName(abName, bypassTrash=True)
                         else:
                             yield abColl.unshare()
 

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -969,7 +969,7 @@
         @type name: C{str}
         """
 
-        yield resource._removeInternal(internal_state=ComponentRemoveState.INTERNAL)
+        yield resource._removeInternal(internal_state=ComponentRemoveState.INTERNAL, bypassTrash=True)
 
 
     def resetAttendeePartstat(self, component, cuas, partstat, hadRSVP=False):

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/utils.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/utils.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/utils.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -43,7 +43,7 @@
             # Delete all but the first one
             log.debug("Should only have zero or one scheduling object resource with UID '%s' in calendar home: %s" % (uid, calendar_home,))
             for resource in objectResources[1:]:
-                yield resource._removeInternal(internal_state=ComponentRemoveState.INTERNAL)
+                yield resource._removeInternal(internal_state=ComponentRemoveState.INTERNAL, bypassTrash=True)
             objectResources = objectResources[:1]
 
         returnValue(objectResources[0] if len(objectResources) == 1 else None)

Modified: CalendarServer/trunk/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/sql.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/caldav/datastore/sql.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -519,8 +519,11 @@
 
 
     @inlineCallbacks
-    def calendars(self):
-        returnValue([c for c in (yield self.children()) if not c.isTrash()])
+    def calendars(self, onlyInTrash=False):
+        if onlyInTrash:
+            returnValue([c for c in (yield self.children()) if c.isTrash()])
+        else:
+            returnValue([c for c in (yield self.children()) if not c.isTrash()])
 
 
     @inlineCallbacks
@@ -1314,7 +1317,7 @@
 
         if child is None:
             child = yield self.objectResourceWithID(rid)
-        yield child._removeInternal(internal_state=ComponentRemoveState.INTERNAL)
+        yield child._removeInternal(internal_state=ComponentRemoveState.INTERNAL, bypassTrash=True)
 
 
     def calendarObjectsInTimeRange(self, start, end, timeZone):
@@ -3529,7 +3532,7 @@
 
                     # Now forcibly delete the event
                     if not inserting:
-                        yield self._removeInternal(internal_state=ComponentRemoveState.INTERNAL)
+                        yield self._removeInternal(internal_state=ComponentRemoveState.INTERNAL, bypassTrash=True)
                         raise ResourceDeletedError("Resource modified but immediately deleted by the server.")
                     else:
                         raise AttendeeAllowedError("Attendee cannot create event for Organizer: {0}".format(implicit_result,))
@@ -4103,9 +4106,10 @@
         return succeed(None)
 
 
-    def remove(self, implicitly=True):
+    def remove(self, implicitly=True, bypassTrash=False):
         return self._removeInternal(
-            internal_state=ComponentRemoveState.NORMAL if implicitly else ComponentRemoveState.NORMAL_NO_IMPLICIT
+            internal_state=ComponentRemoveState.NORMAL if implicitly else ComponentRemoveState.NORMAL_NO_IMPLICIT,
+            bypassTrash=bypassTrash
         )
 
 
@@ -4114,12 +4118,14 @@
         Do a "silent" removal of this object resource.
         """
         return self._removeInternal(
-            ComponentRemoveState.NORMAL_NO_IMPLICIT
+            ComponentRemoveState.NORMAL_NO_IMPLICIT, bypassTrash=True
         )
 
 
     @inlineCallbacks
-    def _removeInternal(self, internal_state=ComponentRemoveState.NORMAL):
+    def _removeInternal(
+        self, internal_state=ComponentRemoveState.NORMAL, bypassTrash=False
+    ):
 
         isinbox = self._calendar.isInbox()
 
@@ -4144,20 +4150,21 @@
                 yield DropBoxAttachment.resourceRemoved(self._txn, self._resourceID, self._dropboxID)
             yield ManagedAttachment.resourceRemoved(self._txn, self._resourceID)
 
-        if isinbox: # bypass the trash
-            yield super(CalendarObject, self).reallyRemove()
+        if isinbox:
+            bypassTrash = True
         else:
             calendar = (yield self.componentForUser())
             status = calendar.mainComponent().getProperty("STATUS")
             if status is not None:
                 status = status.strvalue()
                 if status == "CANCELLED":
-                    yield super(CalendarObject, self).reallyRemove()
-                else:
-                    yield super(CalendarObject, self).remove()
-            else:
-                yield super(CalendarObject, self).remove()
+                    bypassTrash = True
 
+        if bypassTrash:
+            yield super(CalendarObject, self).reallyRemove()
+        else:
+            yield super(CalendarObject, self).remove()
+
         # Do scheduling
         if scheduler is not None:
             # Cannot do implicit in sharee's shared calendar
@@ -5039,7 +5046,7 @@
             yield self._setComponentInternal(ical_new, internal_state=ComponentUpdateState.SPLIT_ATTENDEE)
         else:
             # The split removed all components from this object - remove it
-            yield self._removeInternal(internal_state=ComponentRemoveState.INTERNAL)
+            yield self._removeInternal(internal_state=ComponentRemoveState.INTERNAL, bypassTrash=True)
 
         # Create a new resource and store its data (but not if the parent is "inbox", or if it is empty)
         if not self.calendar().isInbox() and ical_old.mainType() is not None:

Modified: CalendarServer/trunk/txdav/caldav/datastore/sql_external.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/sql_external.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/caldav/datastore/sql_external.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -218,7 +218,9 @@
         raise AssertionError("CalendarObjectExternal: not supported")
 
 
-    def _removeInternal(self, internal_state=ComponentRemoveState.NORMAL):
+    def _removeInternal(
+        self, internal_state=ComponentRemoveState.NORMAL, bypassTrash=False
+    ):
         raise AssertionError("CalendarObjectExternal: not supported")
 
 

Modified: CalendarServer/trunk/txdav/caldav/datastore/test/common.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/common.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/common.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -756,6 +756,7 @@
         exists.
         """
         home = yield self.homeUnderTest()
+        trash = yield home.getTrash(create=True)
 
         # FIXME: test transactions
         for name in home1_calendarNames:
@@ -766,14 +767,20 @@
         yield self.commit()
 
         # Make sure notification fired after commit
+        expected = [
+            ("/CalDAV/example.com/home1/", PushPriority.high),
+            ("/CalDAV/example.com/home1/calendar_1/", PushPriority.high),
+            ("/CalDAV/example.com/home1/calendar_2/", PushPriority.high),
+            ("/CalDAV/example.com/home1/calendar_empty/", PushPriority.high),
+        ]
+        if trash:
+            expected.append(
+                ("/CalDAV/example.com/home1/{}/".format(trash.name()), PushPriority.high),
+            )
+
         self.assertEquals(
             set(self.notifierFactory.history),
-            set([
-                ("/CalDAV/example.com/home1/", PushPriority.high),
-                ("/CalDAV/example.com/home1/calendar_1/", PushPriority.high),
-                ("/CalDAV/example.com/home1/calendar_2/", PushPriority.high),
-                ("/CalDAV/example.com/home1/calendar_empty/", PushPriority.high),
-            ])
+            set(expected)
         )
 
 
@@ -876,7 +883,7 @@
         ctxn = self.concurrentTransaction()
         calendar1prime = yield self.calendarUnderTest(ctxn)
         obj1 = yield calendar1prime.calendarObjectWithName("1.ics")
-        yield obj1.remove()
+        yield obj1.remove(bypassTrash=True)
         yield ctxn.commit()
         try:
             retrieval = yield calendarObject.component()
@@ -927,6 +934,8 @@
         """
         Remove an existing calendar object.
         """
+        home = yield self.homeUnderTest()
+        trash = yield home.getTrash(create=True)
         calendar = yield self.calendarUnderTest()
         for name in calendar1_objectNames:
             uid = (u'uid' + name.rstrip(".ics"))
@@ -942,13 +951,18 @@
                 None
             )
 
+        expected = [
+            ("/CalDAV/example.com/home1/", PushPriority.high),
+            ("/CalDAV/example.com/home1/calendar_1/", PushPriority.high),
+        ]
+        if trash:
+            expected.append(
+                ("/CalDAV/example.com/home1/{}/".format(trash.name()), PushPriority.high),
+            )
         # notify is called prior to commit
         self.assertEquals(
             set(self.notifierFactory.history),
-            set([
-                ("/CalDAV/example.com/home1/", PushPriority.high),
-                ("/CalDAV/example.com/home1/calendar_1/", PushPriority.high),
-            ])
+            set(expected)
         )
         yield self.commit()
 
@@ -1610,13 +1624,25 @@
 
         home = yield self.homeUnderTest()
 
+        expected = [
+            "calendar_1/",
+            "calendar_1/new.ics",
+            "calendar_1/2.ics",
+            "other-calendar/"
+        ]
+
+        trash = yield home.getTrash()
+        if trash is not None:
+            trashed = yield trash.calendarObjects()
+            expected.extend([
+                "{}/".format(trash.name()),
+                "{}/{}".format(trash.name(), trashed[0].name()),
+            ])
+
         changed, deleted, invalid = yield home.resourceNamesSinceToken(
             self.token2revision(st), "infinity")
 
-        self.assertEquals(set(changed), set(["calendar_1/",
-                                             "calendar_1/new.ics",
-                                             "calendar_1/2.ics",
-                                             "other-calendar/"]))
+        self.assertEquals(set(changed), set(expected))
         self.assertEquals(set(deleted), set(["calendar_1/2.ics"]))
         self.assertEquals(invalid, [])
 

Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_attachments.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/test_attachments.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_attachments.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -818,7 +818,7 @@
 
         # Remove resource
         obj = yield self.calendarObjectUnderTest()
-        yield obj.remove()
+        yield obj.remove(bypassTrash=True)
         yield self.commit()
 
         self.assertTrue(os.path.exists(apath))
@@ -830,7 +830,7 @@
 
         # Remove resource
         obj = yield self.calendarObjectUnderTest(name="test.ics")
-        yield obj.remove()
+        yield obj.remove(bypassTrash=True)
         yield self.commit()
 
         self.assertFalse(os.path.exists(apath))

Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -827,7 +827,7 @@
 
         # Remove calendar and check for no properties
         home = yield self.homeUnderTest()
-        yield home.removeCalendarWithName(name)
+        yield home.removeCalendarWithName(name, bypassTrash=True)
         rows = yield _allWithID.on(self.transactionUnderTest(), resourceID=resourceID)
         self.assertEqual(len(tuple(rows)), 0)
         yield self.commit()
@@ -1218,7 +1218,7 @@
         home = yield self.transactionUnderTest().calendarHomeWithUID("home_defaults")
         self.assertEqual(home._default_events, default_events._resourceID)
         self.assertEqual(home._default_tasks, default_tasks._resourceID)
-        yield home.removeCalendarWithName("calendar_1-vtodo")
+        yield home.removeCalendarWithName("calendar_1-vtodo", bypassTrash=True)
         yield self.commit()
 
         home = yield self.transactionUnderTest().calendarHomeWithUID("home_defaults")
@@ -1295,7 +1295,7 @@
 
         home = yield self.homeUnderTest(name="home_defaults")
         calendar1 = yield home.calendarWithName("calendar_1")
-        yield calendar1.remove()
+        yield calendar1.remove(bypassTrash=True)
         yield self.commit()
 
         home = yield self.homeUnderTest(name="home_defaults")
@@ -3613,7 +3613,7 @@
         yield self.abort()
 
         cobj = yield self.calendarObjectUnderTest(name="data1.ics", calendar_name="calendar", home="user01")
-        yield cobj.remove()
+        yield cobj.remove(bypassTrash=True)
         yield self.commit()
 
         rows = yield Select(

Modified: CalendarServer/trunk/txdav/carddav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/sql.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/carddav/datastore/sql.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -888,7 +888,7 @@
 
 
     @inlineCallbacks
-    def remove(self):
+    def remove(self, bypassTrash=True):
 
         if self._resourceID == self._home._resourceID:
 

Modified: CalendarServer/trunk/txdav/common/datastore/file.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/file.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/common/datastore/file.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -848,7 +848,7 @@
 
 
     @writeOperation
-    def removeChildWithName(self, name):
+    def removeChildWithName(self, name, bypassTrash=False):
         if name.startswith(".") or name in self._removedChildren:
             raise NoSuchHomeChildError(name)
 
@@ -865,6 +865,10 @@
                 self._removedChildren.add(name)
 
 
+    def getTrash(self, create=False):
+        return succeed(None)
+
+
     @inlineCallbacks
     def syncToken(self):
 
@@ -1399,7 +1403,7 @@
         raise NotImplementedError
 
 
-    def remove(self):
+    def remove(self, bypassTrash=False):
 
         # FIXME: test for undo
         objectResourcePath = self._path

Modified: CalendarServer/trunk/txdav/common/datastore/podding/migration/test/test_home_sync.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/podding/migration/test/test_home_sync.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/common/datastore/podding/migration/test/test_home_sync.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -552,7 +552,7 @@
         home0 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name="user01", create=True)
         calendar0 = yield home0.childWithName("new-calendar")
         del details0[calendar0.id()]
-        yield calendar0.remove()
+        yield calendar0.remove(bypassTrash=True)
         yield self.commitTransaction(0)
 
         # Trigger sync

Modified: CalendarServer/trunk/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/common/datastore/sql.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -1088,7 +1088,7 @@
             home = (yield self.calendarHomeWithUID(uid))
             calendar = (yield home.childWithName(calendarName))
             resource = (yield calendar.objectResourceWithName(eventName))
-            yield resource.remove(implicitly=False)
+            yield resource.remove(implicitly=False, bypassTrash=True)
             count += 1
         returnValue(count)
 
@@ -2308,14 +2308,14 @@
 
 
     @inlineCallbacks
-    def removeChildWithName(self, name):
+    def removeChildWithName(self, name, bypassTrash=False):
         child = yield self.childWithName(name)
         if child is None:
             raise NoSuchHomeChildError()
         key = self._childrenKey(child.isInTrash())
         resourceID = child._resourceID
 
-        yield child.remove()
+        yield child.remove(bypassTrash=bypassTrash)
         self._children[key].pop(name, None)
         self._children[key].pop(resourceID, None)
 
@@ -3455,7 +3455,7 @@
 
 
     @inlineCallbacks
-    def remove(self):
+    def remove(self, bypassTrash=False):
         """
         Just moves the collection to the trash
         """
@@ -3465,7 +3465,10 @@
             if isInTrash:
                 raise AlreadyInTrashError
             else:
-                yield self.toTrash()
+                if bypassTrash:
+                    yield self.reallyRemove()
+                else:
+                    yield self.toTrash()
         else:
             yield self.reallyRemove()
 

Modified: CalendarServer/trunk/txdav/common/datastore/sql_external.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_external.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/common/datastore/sql_external.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -132,7 +132,7 @@
         returnValue(child)
 
 
-    def removeChildWithName(self, name):
+    def removeChildWithName(self, name, bypassTrash=False):
         """
         No children.
         """
@@ -147,7 +147,7 @@
         """
         if child._bindUID is None:
             raise AssertionError("CommonHomeExternal: not supported")
-        yield super(CommonHomeExternal, self).removeChildWithName(child.name())
+        yield super(CommonHomeExternal, self).removeChildWithName(child.name(), bypassTrash=True)
 
 
     def syncToken(self):
@@ -294,13 +294,13 @@
 
 
     @inlineCallbacks
-    def remove(self):
+    def remove(self, bypassTrash=True):
         """
         External shares are never removed directly - instead they must be "uninvited". However,
         the owner's external calendar can be removed.
         """
         if self.owned():
-            yield super(CommonHomeChildExternal, self).remove()
+            yield super(CommonHomeChildExternal, self).remove(bypassTrash=bypassTrash)
         else:
             raise AssertionError("CommonHomeChildExternal: not supported")
 

Modified: CalendarServer/trunk/txdav/common/datastore/sql_notification.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_notification.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/common/datastore/sql_notification.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -563,7 +563,7 @@
 
 
     @inlineCallbacks
-    def remove(self):
+    def remove(self, bypassTrash=True):
         """
         Remove DB rows corresponding to this notification home.
         """

Modified: CalendarServer/trunk/txdav/common/datastore/test/util.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/test/util.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/common/datastore/test/util.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -509,11 +509,12 @@
                 if config.RestrictCalendarsToOneComponentType:
                     for name in ical.allowedStoreComponents:
                         yield home.removeCalendarWithName(
-                            home._componentCalendarName[name]
+                            home._componentCalendarName[name],
+                            bypassTrash=True
                         )
                 else:
-                    yield home.removeCalendarWithName("calendar")
-                yield home.removeCalendarWithName("inbox")
+                    yield home.removeCalendarWithName("calendar", bypassTrash=True)
+                yield home.removeCalendarWithName("inbox", bypassTrash=True)
             except NoSuchHomeChildError:
                 pass
 

Modified: CalendarServer/trunk/txdav/common/datastore/work/test/test_inbox_cleanup.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/work/test/test_inbox_cleanup.py	2015-03-29 05:57:59 UTC (rev 14632)
+++ CalendarServer/trunk/txdav/common/datastore/work/test/test_inbox_cleanup.py	2015-03-30 16:19:36 UTC (rev 14633)
@@ -164,7 +164,7 @@
         # create orphans by deleting events
         cal = yield self.calendarUnderTest(home="user01", name="calendar")
         for item in (yield cal.objectResourcesWithNames(["cal1.ics", "cal3.ics"])):
-            yield item.remove()
+            yield item.remove(bypassTrash=True)
 
         # do cleanup
         yield self.transactionUnderTest().enqueue(CleanupOneInboxWork, homeID=cal.ownerHome()._resourceID, notBefore=datetime.datetime.utcnow())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150330/3f2bd310/attachment-0001.html>


More information about the calendarserver-changes mailing list