[CalendarServer-changes] [9630] CalendarServer/branches/users/glyph/q

source_changes at macosforge.org source_changes at macosforge.org
Sat Aug 11 01:55:06 PDT 2012


Revision: 9630
          http://trac.macosforge.org/projects/calendarserver/changeset/9630
Author:   glyph at apple.com
Date:     2012-08-11 01:55:05 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
implementation of deletion, preserve transaction on load

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/q/twext/enterprise/dal/record.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/q/

Modified: CalendarServer/branches/users/glyph/q/twext/enterprise/dal/record.py
===================================================================
--- CalendarServer/branches/users/glyph/q/twext/enterprise/dal/record.py	2012-08-11 08:55:05 UTC (rev 9629)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/dal/record.py	2012-08-11 08:55:05 UTC (rev 9630)
@@ -26,6 +26,7 @@
 from twext.enterprise.dal.syntax import Select, Tuple, Constant, ColumnSyntax
 from twext.enterprise.dal.syntax import Insert
 from twext.enterprise.dal.syntax import Update
+from twext.enterprise.dal.syntax import Delete
 
 class ReadOnly(AttributeError):
     """
@@ -101,7 +102,7 @@
         for (column, value) in zip(allColumns, row):
             name = cls.__colmap__[column]
             setattr(self, name, value)
-        # FIXME: self.__txn__ = txn
+        self.__txn__ = txn
         returnValue(self)
 
 
@@ -127,6 +128,18 @@
         returnValue(self)
 
 
+    def delete(self):
+        """
+        Delete this row from the database.
+
+        @return: a L{Deferred} which fires when the underlying row has been
+            deleted.
+        """
+        return Delete(From=self.__tbl__,
+                      Where=self._primaryKeyComparison(self._primaryKeyValue())
+                      ).on(self.__txn__)
+
+
     @inlineCallbacks
     def update(self, **kw):
         """
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/56ea311e/attachment.html>


More information about the calendarserver-changes mailing list