[CalendarServer-changes] [205] CalendarServer/trunk/twistedcaldav/static.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 26 14:23:52 PDT 2006


Revision: 205
          http://trac.macosforge.org/projects/collaboration/changeset/205
Author:   wsanchez at apple.com
Date:     2006-09-26 14:23:50 -0700 (Tue, 26 Sep 2006)

Log Message:
-----------
Cosmetic, and better error handling.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/static.py

Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py	2006-09-26 20:40:01 UTC (rev 204)
+++ CalendarServer/trunk/twistedcaldav/static.py	2006-09-26 21:23:50 UTC (rev 205)
@@ -110,27 +110,23 @@
         #
         # Create the collection once we know it is safe to do so
         #
-        def _deferOK(result):
-            if result != responsecode.CREATED:
+        def onCollection(status):
+            if status != responsecode.CREATED:
                 raise HTTPError(result)
     
             self.writeDeadProperty(davxml.ResourceType.calendar)
-            return responsecode.CREATED
+            return status
         
-        def _deferErr(f):
+        def onError(f):
             try:
                 rmdir(self.fp)
             except Exception, e:
                 log.err("Unable to clean up after failed MKCALENDAR: %s" % e)
-    
-            if isinstance(f.value, HTTPError):
-                return f.value.response
-    
-            f.raiseException()
-            
+            return f
+
         d = mkcollection(self.fp)
-        d.addCallback(_deferOK)
-        d.addErrback(_deferErr)
+        d.addCallback(onCollection)
+        d.addErrback(onError)
         return d
  
     def iCalendarRolledup(self, request):

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20060926/9581c185/attachment.html


More information about the calendarserver-changes mailing list