<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[14258] CalendarServer/branches/users/sagen/trashcan</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/14258">14258</a></dd>
<dt>Author</dt> <dd>sagen@apple.com</dd>
<dt>Date</dt> <dd>2015-01-07 10:17:29 -0800 (Wed, 07 Jan 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Checkpoint of trashcan work</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesuserssagentrashcantwistedcaldavmethodreport_sync_collectionpy">CalendarServer/branches/users/sagen/trashcan/twistedcaldav/method/report_sync_collection.py</a></li>
<li><a href="#CalendarServerbranchesuserssagentrashcantwistedcaldavstorebridgepy">CalendarServer/branches/users/sagen/trashcan/twistedcaldav/storebridge.py</a></li>
<li><a href="#CalendarServerbranchesuserssagentrashcantxdavcaldavdatastoresqlpy">CalendarServer/branches/users/sagen/trashcan/txdav/caldav/datastore/sql.py</a></li>
<li><a href="#CalendarServerbranchesuserssagentrashcantxdavcaldavdatastoretesttest_sqlpy">CalendarServer/branches/users/sagen/trashcan/txdav/caldav/datastore/test/test_sql.py</a></li>
<li><a href="#CalendarServerbranchesuserssagentrashcantxdavcarddavdatastoresqlpy">CalendarServer/branches/users/sagen/trashcan/txdav/carddav/datastore/sql.py</a></li>
<li><a href="#CalendarServerbranchesuserssagentrashcantxdavcommondatastoresqlpy">CalendarServer/branches/users/sagen/trashcan/txdav/common/datastore/sql.py</a></li>
<li><a href="#CalendarServerbranchesuserssagentrashcantxdavcommondatastoretestutilpy">CalendarServer/branches/users/sagen/trashcan/txdav/common/datastore/test/util.py</a></li>
<li><a href="#CalendarServerbranchesuserssagentrashcantxdavcommonicommondatastorepy">CalendarServer/branches/users/sagen/trashcan/txdav/common/icommondatastore.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesuserssagentrashcantwistedcaldavmethodreport_sync_collectionpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/trashcan/twistedcaldav/method/report_sync_collection.py (14257 => 14258)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/trashcan/twistedcaldav/method/report_sync_collection.py        2015-01-07 18:09:06 UTC (rev 14257)
+++ CalendarServer/branches/users/sagen/trashcan/twistedcaldav/method/report_sync_collection.py        2015-01-07 18:17:29 UTC (rev 14258)
</span><span class="lines">@@ -25,7 +25,9 @@
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks, returnValue
</span><span class="cx"> 
</span><span class="cx"> from twistedcaldav.config import config
</span><del>-from twistedcaldav.method.report_common import _namedPropertiesForResource
</del><ins>+from twistedcaldav.method.report_common import (
+    _namedPropertiesForResource, responseForHref
+)
</ins><span class="cx"> 
</span><span class="cx"> from txdav.common.icommondatastore import ConcurrentModification
</span><span class="cx"> from txdav.xml import element
</span><span class="lines">@@ -33,7 +35,6 @@
</span><span class="cx"> from txweb2 import responsecode
</span><span class="cx"> from txweb2.dav.http import ErrorResponse
</span><span class="cx"> from txweb2.dav.http import MultiStatusResponse
</span><del>-from txweb2.dav.method.prop_common import responseForHref
</del><span class="cx"> from txweb2.dav.util import joinURL
</span><span class="cx"> from txweb2.http import HTTPError, StatusResponse
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagentrashcantwistedcaldavstorebridgepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/trashcan/twistedcaldav/storebridge.py (14257 => 14258)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/trashcan/twistedcaldav/storebridge.py        2015-01-07 18:09:06 UTC (rev 14257)
+++ CalendarServer/branches/users/sagen/trashcan/twistedcaldav/storebridge.py        2015-01-07 18:17:29 UTC (rev 14258)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx">     InvalidObjectResourceError, ObjectResourceNameNotAllowedError,
</span><span class="cx">     ObjectResourceNameAlreadyExistsError, UIDExistsError,
</span><span class="cx">     UIDExistsElsewhereError, InvalidUIDError, InvalidResourceMove,
</span><del>-    InvalidComponentForStoreError
</del><ins>+    InvalidComponentForStoreError, AlreadyInTrashError
</ins><span class="cx"> )
</span><span class="cx"> from txdav.idav import PropertyChangeNotAllowedError
</span><span class="cx"> from txdav.who.wiki import RecordType as WikiRecordType
</span><span class="lines">@@ -2700,6 +2700,7 @@
</span><span class="cx">         DuplicatePrivateCommentsError: (_CommonObjectResource._storeExceptionError, (calendarserver_namespace, &quot;no-duplicate-private-comments&quot;,),),
</span><span class="cx">         LockTimeout: (_CommonObjectResource._storeExceptionUnavailable, &quot;Lock timed out.&quot;,),
</span><span class="cx">         UnknownTimezone: (_CommonObjectResource._storeExceptionError, (caldav_namespace, &quot;valid-timezone&quot;),),
</span><ins>+        AlreadyInTrashError: (_CommonObjectResource._storeExceptionError, (calendarserver_namespace, &quot;not-in-trash&quot;,),),
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     StoreMoveExceptionsErrors = {
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagentrashcantxdavcaldavdatastoresqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/trashcan/txdav/caldav/datastore/sql.py (14257 => 14258)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/trashcan/txdav/caldav/datastore/sql.py        2015-01-07 18:09:06 UTC (rev 14257)
+++ CalendarServer/branches/users/sagen/trashcan/txdav/caldav/datastore/sql.py        2015-01-07 18:17:29 UTC (rev 14258)
</span><span class="lines">@@ -692,6 +692,9 @@
</span><span class="cx">             # Ignore inbox - also shared calendars are not part of .calendars()
</span><span class="cx">             if calendar.isInbox():
</span><span class="cx">                 continue
</span><ins>+            # Ignore trash
+            if calendar.isTrash():
+                continue
</ins><span class="cx">             split_count = yield calendar.splitCollectionByComponentTypes()
</span><span class="cx">             self.log.warn(&quot;  Calendar: '{0}', split into {1}&quot;.format(calendar.name(), split_count + 1,))
</span><span class="cx"> 
</span><span class="lines">@@ -713,6 +716,8 @@
</span><span class="cx">             for calendar in calendars:
</span><span class="cx">                 if calendar.isInbox():
</span><span class="cx">                     continue
</span><ins>+                if calendar.isTrash():
+                    continue
</ins><span class="cx">                 names.add(calendar.name())
</span><span class="cx">                 result = yield calendar.getSupportedComponents()
</span><span class="cx">                 supported_components.update(result.split(&quot;,&quot;))
</span><span class="lines">@@ -753,6 +758,8 @@
</span><span class="cx">         # Check validity of the default
</span><span class="cx">         if calendar.isInbox():
</span><span class="cx">             raise InvalidDefaultCalendar(&quot;Cannot set inbox as a default calendar&quot;)
</span><ins>+        elif calendar.isTrash():
+            raise InvalidDefaultCalendar(&quot;Cannot set trash as a default calendar&quot;)
</ins><span class="cx">         elif not calendar.owned():
</span><span class="cx">             raise InvalidDefaultCalendar(&quot;Cannot set shared calendar as a default calendar&quot;)
</span><span class="cx">         elif not calendar.isSupportedComponent(componentType):
</span><span class="lines">@@ -807,6 +814,8 @@
</span><span class="cx">         if default is not None:
</span><span class="cx">             if default.isInbox():
</span><span class="cx">                 default = None
</span><ins>+            elif default.isTrash():
+                default = None
</ins><span class="cx">             elif not default.owned():
</span><span class="cx">                 default = None
</span><span class="cx">             elif not default.isSupportedComponent(componentType):
</span><span class="lines">@@ -822,6 +831,8 @@
</span><span class="cx">                 calendar = (yield self.calendarWithName(calendarName))
</span><span class="cx">                 if calendar.isInbox():
</span><span class="cx">                     continue
</span><ins>+                elif calendar.isTrash():
+                    continue
</ins><span class="cx">                 elif not calendar.owned():
</span><span class="cx">                     continue
</span><span class="cx">                 elif not calendar.isSupportedComponent(componentType):
</span><span class="lines">@@ -1313,7 +1324,7 @@
</span><span class="cx">         @return: C{True} if it does, C{False} otherwise
</span><span class="cx">         @rtype: C{bool}
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        return (self._transp == _TRANSP_OPAQUE) and not self.isInbox()
</del><ins>+        return (self._transp == _TRANSP_OPAQUE) and not self.isInbox() and not self.isTrash()
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><span class="lines">@@ -1327,7 +1338,7 @@
</span><span class="cx">         @type use_it: C{bool}
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx"> 
</span><del>-        self._transp = _TRANSP_OPAQUE if use_it and not self.isInbox() else _TRANSP_TRANSPARENT
</del><ins>+        self._transp = _TRANSP_OPAQUE if use_it and (not self.isInbox() and not self.isTrash()) else _TRANSP_TRANSPARENT
</ins><span class="cx">         cal = self._bindSchema
</span><span class="cx">         yield Update(
</span><span class="cx">             {cal.TRANSP : self._transp},
</span><span class="lines">@@ -3893,7 +3904,7 @@
</span><span class="cx">             if self._dropboxID:
</span><span class="cx">                 yield DropBoxAttachment.resourceRemoved(self._txn, self._resourceID, self._dropboxID)
</span><span class="cx">             yield ManagedAttachment.resourceRemoved(self._txn, self._resourceID)
</span><del>-        yield super(CalendarObject, self).remove()
</del><ins>+        yield super(CalendarObject, self).reallyRemove()
</ins><span class="cx"> 
</span><span class="cx">         # Do scheduling
</span><span class="cx">         if scheduler is not None:
</span><span class="lines">@@ -5711,6 +5722,19 @@
</span><span class="cx">         )
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    def isTrash(self):
+        return True
+
+
+    def nameForResource(self, collection, objectResource):
+        return &quot;{}-{}&quot;.format(collection._resourceID, objectResource.name())
+
+
+    def parseName(self, name):
+        parentID, resourceName = name.split(&quot;-&quot;, 1)
+        return int(parentID), resourceName
+
+
</ins><span class="cx">     @inlineCallbacks
</span><span class="cx">     def listObjectResources(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="lines">@@ -5730,13 +5754,12 @@
</span><span class="cx">                     objectResource = (
</span><span class="cx">                         yield child.objectResourceWithID(objectID)
</span><span class="cx">                     )
</span><del>-                    results.append(objectResource.name())
</del><ins>+                    results.append(self.nameForResource(child, objectResource))
</ins><span class="cx"> 
</span><span class="cx">         returnValue(results)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> # Hook-up class relationships at the end after they have all been defined
</span><span class="cx"> from txdav.caldav.datastore.sql_external import CalendarHomeExternal, CalendarExternal, CalendarObjectExternal
</span><span class="cx"> CalendarHome._externalClass = CalendarHomeExternal
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagentrashcantxdavcaldavdatastoretesttest_sqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/trashcan/txdav/caldav/datastore/test/test_sql.py (14257 => 14258)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/trashcan/txdav/caldav/datastore/test/test_sql.py        2015-01-07 18:09:06 UTC (rev 14257)
+++ CalendarServer/branches/users/sagen/trashcan/txdav/caldav/datastore/test/test_sql.py        2015-01-07 18:17:29 UTC (rev 14258)
</span><span class="lines">@@ -466,7 +466,7 @@
</span><span class="cx">         )
</span><span class="cx">         yield migrateHome(fromHome, toHome, lambda x: x.component())
</span><span class="cx">         toCalendars = yield toHome.calendars()
</span><del>-        self.assertEquals(set([c.name() for c in toCalendars if c.name() != &quot;inbox&quot;]),
</del><ins>+        self.assertEquals(set([c.name() for c in toCalendars if c.name() not in (&quot;inbox&quot;, &quot;trash&quot;)]),
</ins><span class="cx">                           set([k for k in self.requirements['home1'].keys()
</span><span class="cx">                                if self.requirements['home1'][k] is not None]))
</span><span class="cx">         fromCalendars = yield fromHome.calendars()
</span><span class="lines">@@ -496,9 +496,9 @@
</span><span class="cx">             )
</span><span class="cx"> 
</span><span class="cx">         supported_components = set()
</span><del>-        self.assertEqual(len(toCalendars), 2 + len(ical.allowedStoreComponents))
</del><ins>+        self.assertEqual(len(toCalendars), 3 + len(ical.allowedStoreComponents))
</ins><span class="cx">         for calendar in toCalendars:
</span><del>-            if calendar.name() == &quot;inbox&quot;:
</del><ins>+            if calendar.name() in (&quot;inbox&quot;, &quot;trash&quot;):
</ins><span class="cx">                 continue
</span><span class="cx">             result = yield calendar.getSupportedComponents()
</span><span class="cx">             supported_components.add(result)
</span><span class="lines">@@ -524,7 +524,7 @@
</span><span class="cx">             )
</span><span class="cx"> 
</span><span class="cx">         supported_components = set()
</span><del>-        self.assertEqual(len(toCalendars), 3)
</del><ins>+        self.assertEqual(len(toCalendars), 4)
</ins><span class="cx">         for calendar in toCalendars:
</span><span class="cx">             if calendar.name() == &quot;inbox&quot;:
</span><span class="cx">                 continue
</span><span class="lines">@@ -1947,7 +1947,7 @@
</span><span class="cx"> 
</span><span class="cx">         home = yield self.homeUnderTest(name=&quot;user01&quot;)
</span><span class="cx">         children = yield home.loadChildren()
</span><del>-        self.assertEqual(len(children), 3)
</del><ins>+        self.assertEqual(len(children), 4)
</ins><span class="cx">         yield self.commit()
</span><span class="cx"> 
</span><span class="cx">         calendar = yield self.calendarUnderTest(home=&quot;user01&quot;, name=&quot;calendar&quot;)
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagentrashcantxdavcarddavdatastoresqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/trashcan/txdav/carddav/datastore/sql.py (14257 => 14258)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/trashcan/txdav/carddav/datastore/sql.py        2015-01-07 18:09:06 UTC (rev 14257)
+++ CalendarServer/branches/users/sagen/trashcan/txdav/carddav/datastore/sql.py        2015-01-07 18:17:29 UTC (rev 14258)
</span><span class="lines">@@ -2130,7 +2130,7 @@
</span><span class="cx">                     removed=True,
</span><span class="cx">                 )
</span><span class="cx"> 
</span><del>-        yield super(AddressBookObject, self).remove()
</del><ins>+        yield super(AddressBookObject, self).reallyRemove() # FIXME: carddav trash?
</ins><span class="cx">         self._kind = None
</span><span class="cx">         self._ownerAddressBookResourceID = None
</span><span class="cx">         self._objectText = None
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagentrashcantxdavcommondatastoresqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/trashcan/txdav/common/datastore/sql.py (14257 => 14258)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/trashcan/txdav/common/datastore/sql.py        2015-01-07 18:09:06 UTC (rev 14257)
+++ CalendarServer/branches/users/sagen/trashcan/txdav/common/datastore/sql.py        2015-01-07 18:17:29 UTC (rev 14258)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx">     ObjectResourceNameNotAllowedError, ObjectResourceNameAlreadyExistsError, \
</span><span class="cx">     NoSuchObjectResourceError, AllRetriesFailed, InvalidSubscriptionValues, \
</span><span class="cx">     InvalidIMIPTokenValues, TooManyObjectResourcesError, \
</span><del>-    SyncTokenValidException
</del><ins>+    SyncTokenValidException, AlreadyInTrashError
</ins><span class="cx"> from txdav.common.idirectoryservice import IStoreDirectoryService, \
</span><span class="cx">     DirectoryRecordNotFoundError
</span><span class="cx"> from txdav.common.inotifications import INotificationCollection, \
</span><span class="lines">@@ -5695,6 +5695,10 @@
</span><span class="cx">             self._notifiers = None
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    def isTrash(self):
+        return False
+
+
</ins><span class="cx">     def memoMe(self, key, memo):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Add this object to the memo dictionary in whatever fashion is appropriate.
</span><span class="lines">@@ -6846,18 +6850,28 @@
</span><span class="cx"> 
</span><span class="cx">         rows = None
</span><span class="cx">         if name:
</span><ins>+            if parent.isTrash():
+                # the name needs to be split
+                parentID, name = parent.parseName(name)
+            else:
+                parentID = parent._resourceID
+
</ins><span class="cx">             rows = yield cls._allColumnsWithParentAndName.on(
</span><span class="cx">                 parent._txn,
</span><span class="cx">                 name=name,
</span><del>-                parentID=parent._resourceID
</del><ins>+                parentID=parentID
</ins><span class="cx">             )
</span><span class="cx">         elif uid:
</span><ins>+            assert not parent.isTrash(), &quot;UID lookup in Trash not supported&quot;
+
</ins><span class="cx">             rows = yield cls._allColumnsWithParentAndUID.on(
</span><span class="cx">                 parent._txn,
</span><span class="cx">                 uid=uid,
</span><span class="cx">                 parentID=parent._resourceID
</span><span class="cx">             )
</span><span class="cx">         elif resourceID:
</span><ins>+            assert not parent.isTrash(), &quot;ID lookup in Trash not supported&quot;
+
</ins><span class="cx">             rows = yield cls._allColumnsWithParentAndID.on(
</span><span class="cx">                 parent._txn,
</span><span class="cx">                 resourceID=resourceID,
</span><span class="lines">@@ -7335,9 +7349,13 @@
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Just moves the object to the trash
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        yield self.toTrash()
</del><span class="cx"> 
</span><ins>+        if self._parentCollection.isTrash():
+            raise AlreadyInTrashError
+        else:
+            yield self.toTrash()
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx">     @inlineCallbacks
</span><span class="cx">     def reallyRemove(self, options=None):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="lines">@@ -7380,7 +7398,12 @@
</span><span class="cx">         trash = yield self._parentCollection._home.childWithName(&quot;trash&quot;)
</span><span class="cx">         print(&quot;TO TRASH&quot;, trash)
</span><span class="cx">         if trash is not None:
</span><del>-            yield trash._insertRevision(self._name)
</del><ins>+            yield trash._insertRevision(
+                trash.nameForResource(
+                    self._parentCollection,
+                    self
+                )
+            )
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><span class="lines">@@ -7392,7 +7415,12 @@
</span><span class="cx">         trash = yield self._parentCollection._home.childWithName(&quot;trash&quot;)
</span><span class="cx">         print(&quot;FROM TRASH&quot;, trash)
</span><span class="cx">         if trash is not None:
</span><del>-            yield trash._deleteRevision(self._name)
</del><ins>+            yield trash._deleteRevision(
+                trash.nameForResource(
+                    self._parentCollection,
+                    self
+                )
+            )
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @classproperty
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagentrashcantxdavcommondatastoretestutilpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/trashcan/txdav/common/datastore/test/util.py (14257 => 14258)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/trashcan/txdav/common/datastore/test/util.py        2015-01-07 18:09:06 UTC (rev 14257)
+++ CalendarServer/branches/users/sagen/trashcan/txdav/common/datastore/test/util.py        2015-01-07 18:17:29 UTC (rev 14258)
</span><span class="lines">@@ -445,6 +445,7 @@
</span><span class="cx">                 else:
</span><span class="cx">                     yield home.removeCalendarWithName(&quot;calendar&quot;)
</span><span class="cx">                 yield home.removeCalendarWithName(&quot;inbox&quot;)
</span><ins>+                yield home.removeCalendarWithName(&quot;trash&quot;)
</ins><span class="cx">             except NoSuchHomeChildError:
</span><span class="cx">                 pass
</span><span class="cx">             for calendarName in calendars:
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagentrashcantxdavcommonicommondatastorepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/trashcan/txdav/common/icommondatastore.py (14257 => 14258)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/trashcan/txdav/common/icommondatastore.py        2015-01-07 18:09:06 UTC (rev 14257)
+++ CalendarServer/branches/users/sagen/trashcan/txdav/common/icommondatastore.py        2015-01-07 18:17:29 UTC (rev 14258)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx">     &quot;ConcurrentModification&quot;,
</span><span class="cx">     &quot;InvalidObjectResourceError&quot;,
</span><span class="cx">     &quot;InternalDataStoreError&quot;,
</span><ins>+    &quot;AlreadyInTrashError&quot;,
</ins><span class="cx"> ]
</span><span class="cx"> 
</span><span class="cx"> #
</span><span class="lines">@@ -235,6 +236,13 @@
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+class AlreadyInTrashError(CommonStoreError):
+    &quot;&quot;&quot;
+    An object resource being removed is already in the trash.
+    &quot;&quot;&quot;
+
+
+
</ins><span class="cx"> # Indexing / sync tokens
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>