[CalendarServer-changes] [13628] CalendarServer/trunk/calendarserver/tools/gateway.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Jun 10 13:07:52 PDT 2014


Revision: 13628
          http://trac.calendarserver.org//changeset/13628
Author:   sagen at apple.com
Date:     2014-06-10 13:07:51 -0700 (Tue, 10 Jun 2014)
Log Message:
-----------
Deleting a resource or location triggers an automatic purge of their data.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/gateway.py

Modified: CalendarServer/trunk/calendarserver/tools/gateway.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/gateway.py	2014-06-10 19:33:46 UTC (rev 13627)
+++ CalendarServer/trunk/calendarserver/tools/gateway.py	2014-06-10 20:07:51 UTC (rev 13628)
@@ -25,11 +25,18 @@
 import xml
 
 from calendarserver.tools.cmdline import utilityMain
-from calendarserver.tools.config import WRITABLE_CONFIG_KEYS, setKeyPath, getKeyPath, flattenDictionary, WritableConfig
+from calendarserver.tools.config import (
+    WRITABLE_CONFIG_KEYS, setKeyPath, getKeyPath, flattenDictionary,
+    WritableConfig
+)
 from calendarserver.tools.principals import (
     getProxies, setProxies
 )
-from calendarserver.tools.purge import WorkerService, PurgeOldEventsService, DEFAULT_BATCH_SIZE, DEFAULT_RETAIN_DAYS
+from calendarserver.tools.purge import (
+    WorkerService, PurgeOldEventsService,
+    DEFAULT_BATCH_SIZE, DEFAULT_RETAIN_DAYS,
+    PrincipalPurgeWork
+)
 from calendarserver.tools.util import (
     recordForPrincipalID, autoDisableMemcached
 )
@@ -412,14 +419,26 @@
         self.respondWithRecordsOfTypes(self.dir, command, [typeName])
 
 
+    @inlineCallbacks
     def command_deleteLocation(self, command):
-        return self._delete("locations", command)
+        txn = self.store.newTransaction()
+        uid = command['GeneratedUID']
+        yield txn.enqueue(PrincipalPurgeWork, uid=uid)
+        yield txn.commit()
 
+        yield self._delete("locations", command)
 
+
+    @inlineCallbacks
     def command_deleteResource(self, command):
-        return self._delete("resources", command)
+        txn = self.store.newTransaction()
+        uid = command['GeneratedUID']
+        yield txn.enqueue(PrincipalPurgeWork, uid=uid)
+        yield txn.commit()
 
+        yield self._delete("resources", command)
 
+
     def command_deleteAddress(self, command):
         return self._delete("addresses", command)
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140610/b8226593/attachment.html>


More information about the calendarserver-changes mailing list