[CalendarServer-changes] [6945] CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/ sql.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 16 06:28:19 PST 2011


Revision: 6945
          http://trac.macosforge.org/projects/calendarserver/changeset/6945
Author:   glyph at apple.com
Date:     2011-02-16 06:28:19 -0800 (Wed, 16 Feb 2011)
Log Message:
-----------
dalify delete attachment

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py

Modified: CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py	2011-02-16 14:28:07 UTC (rev 6944)
+++ CalendarServer/branches/users/glyph/dalify/txdav/caldav/datastore/sql.py	2011-02-16 14:28:19 UTC (rev 6945)
@@ -832,26 +832,28 @@
         protocol.connectionLost(Failure(ConnectionLost()))
 
 
+    _removeStatement = Delete(
+        From=schema.ATTACHMENT,
+        Where=(schema.ATTACHMENT.DROPBOX_ID == Parameter("dropboxID")).And(
+            schema.ATTACHMENT.PATH == Parameter("path")
+        ))
+
+
     @inlineCallbacks
     def remove(self):
         old_size = self._size
         self._txn.postCommit(self._path.remove)
-        yield self._txn.execSQL(
-            """
-            delete from ATTACHMENT
-             where DROPBOX_ID = %s and PATH = %s
-            """,
-            [self._dropboxID, self._name]
-        )
-
+        yield self._removeStatement.on(self._txn, dropboxID=self._dropboxID,
+                                       path=self._name)
         # Adjust quota
         home = (yield self._txn.calendarHomeWithResourceID(self._ownerHomeID))
         if home:
             yield home.adjustQuotaUsedBytes(-old_size)
-            
+
             # Send change notification to home
             yield home.notifyChanged()
 
+
     # IDataStoreResource
     def contentType(self):
         return self._contentType
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110216/22896978/attachment-0001.html>


More information about the calendarserver-changes mailing list