[CalendarServer-changes] [7007] CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/ sql.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 16 06:40:20 PST 2011


Revision: 7007
          http://trac.macosforge.org/projects/calendarserver/changeset/7007
Author:   glyph at apple.com
Date:     2011-02-16 06:40:20 -0800 (Wed, 16 Feb 2011)
Log Message:
-----------
dalify removeNotificationObjectWithUID

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

Modified: CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py	2011-02-16 14:40:09 UTC (rev 7006)
+++ CalendarServer/branches/users/glyph/dalify/txdav/common/datastore/sql.py	2011-02-16 14:40:20 UTC (rev 7007)
@@ -2441,9 +2441,9 @@
     @inlineCallbacks
     def notificationObjectWithUID(self, uid):
         """
-        We create the empty object first then have it initialize itself from the store
+        Create an empty notification object first then have it initialize itself
+        from the store.
         """
-
         no = NotificationObject(self, uid)
         no = (yield no.initFromStore())
         returnValue(no)
@@ -2468,13 +2468,17 @@
         return self.removeNotificationObjectWithUID(self._nameToUID(name))
 
 
+    _removeByUIDQuery = Delete(
+        From=schema.NOTIFICATION,
+        Where=(schema.NOTIFICATION.NOTIFICATION_UID == Parameter("uid")).And(
+            schema.NOTIFICATION.NOTIFICATION_HOME_RESOURCE_ID
+            == Parameter("resourceID")))
+
+
     @inlineCallbacks
     def removeNotificationObjectWithUID(self, uid):
-        yield self._txn.execSQL(
-            "delete from NOTIFICATION "
-            "where NOTIFICATION_UID = %s and NOTIFICATION_HOME_RESOURCE_ID = %s",
-            [uid, self._resourceID]
-        )
+        yield self._removeByUIDQuery.on(
+            self._txn, uid=uid, resourceID=self._resourceID)
         self._notifications.pop(uid, None)
         yield self._deleteRevision("%s.xml" % (uid,))
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110216/fdb772f8/attachment.html>


More information about the calendarserver-changes mailing list