[CalendarServer-changes] [5776] CalendarServer/branches/new-store/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Fri Jun 18 10:11:53 PDT 2010


Revision: 5776
          http://trac.macosforge.org/projects/calendarserver/changeset/5776
Author:   cdaboo at apple.com
Date:     2010-06-18 10:11:52 -0700 (Fri, 18 Jun 2010)
Log Message:
-----------
Handle property error on MKCALENDAR with a transaction abort.

Modified Paths:
--------------
    CalendarServer/branches/new-store/twistedcaldav/method/mkcalendar.py
    CalendarServer/branches/new-store/twistedcaldav/resource.py

Modified: CalendarServer/branches/new-store/twistedcaldav/method/mkcalendar.py
===================================================================
--- CalendarServer/branches/new-store/twistedcaldav/method/mkcalendar.py	2010-06-18 17:03:56 UTC (rev 5775)
+++ CalendarServer/branches/new-store/twistedcaldav/method/mkcalendar.py	2010-06-18 17:11:52 UTC (rev 5776)
@@ -104,9 +104,8 @@
                     errors.add(responsecode.OK, property)
     
         if got_an_error:
-            # Clean up
-            if self.fp.exists(): self.fp.remove()
-
+            # Force a transaction error and proper clean-up
+            self.transactionError()
             errors.error()
             raise HTTPError(MultiStatusResponse([errors.response()]))
 

Modified: CalendarServer/branches/new-store/twistedcaldav/resource.py
===================================================================
--- CalendarServer/branches/new-store/twistedcaldav/resource.py	2010-06-18 17:03:56 UTC (rev 5775)
+++ CalendarServer/branches/new-store/twistedcaldav/resource.py	2010-06-18 17:11:52 UTC (rev 5776)
@@ -158,6 +158,7 @@
 
 
     _associatedTransaction = None
+    _transactionError = False
 
     def associateWithTransaction(self, transaction):
         """
@@ -189,6 +190,8 @@
             raise RuntimeError("No associated transaction to propagate")
         otherResource.associateWithTransaction(self._associatedTransaction)
 
+    def transactionError(self):
+        self._transactionError = True
 
     def renderHTTP(self, request):
         """
@@ -201,7 +204,10 @@
         d = maybeDeferred(super(CalDAVResource, self).renderHTTP, request)
         def succeeded(result):
             if self._associatedTransaction is not None:
-                self._associatedTransaction.commit()
+                if self._transactionError:
+                    self._associatedTransaction.abort()
+                else:
+                    self._associatedTransaction.commit()
             return result
         # FIXME: needs a failure handler (that rolls back the transaction)
         return d.addCallback(succeeded)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100618/af2f2e1f/attachment-0001.html>


More information about the calendarserver-changes mailing list