[CalendarServer-changes] [8325] CalendarServer/branches/users/glyph/multiget-delete/twistedcaldav/ method/report_multiget_common.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Nov 18 10:13:50 PST 2011


Revision: 8325
          http://trac.macosforge.org/projects/calendarserver/changeset/8325
Author:   glyph at apple.com
Date:     2011-11-18 10:13:50 -0800 (Fri, 18 Nov 2011)
Log Message:
-----------
the logic to handle this was already in place, so adjust it to catch the right exception type

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/multiget-delete/twistedcaldav/method/report_multiget_common.py

Modified: CalendarServer/branches/users/glyph/multiget-delete/twistedcaldav/method/report_multiget_common.py
===================================================================
--- CalendarServer/branches/users/glyph/multiget-delete/twistedcaldav/method/report_multiget_common.py	2011-11-18 18:13:41 UTC (rev 8324)
+++ CalendarServer/branches/users/glyph/multiget-delete/twistedcaldav/method/report_multiget_common.py	2011-11-18 18:13:50 UTC (rev 8325)
@@ -38,6 +38,7 @@
 from twistedcaldav.carddavxml import carddav_namespace
 from twistedcaldav.config import config
 from twistedcaldav.method import report_common
+from txdav.common.icommondatastore import ConcurrentModification
 from twistedcaldav.method.report_common import COLLECTION_TYPE_CALENDAR,\
     COLLECTION_TYPE_ADDRESSBOOK
 from twistedcaldav.query import addressbookqueryfilter
@@ -217,18 +218,28 @@
             # Get properties for all valid readable resources
             for resource, href in ok_resources:
                 try:
-                    yield report_common.responseForHref(request, responses, davxml.HRef.fromString(href), resource, propertiesForResource, propertyreq, isowner=isowner)
+                    yield report_common.responseForHref(
+                        request, responses, davxml.HRef.fromString(href),
+                        resource, propertiesForResource, propertyreq,
+                        isowner=isowner
+                    )
                 except ValueError:
-                    log.err("Invalid calendar resource during multiget: %s" % (href,))
-                    responses.append(davxml.StatusResponse(davxml.HRef.fromString(href), davxml.Status.fromResponseCode(responsecode.FORBIDDEN)))
-                except IOError:
+                    log.err("Invalid calendar resource during multiget: %s" %
+                            (href,))
+                    responses.append(davxml.StatusResponse(
+                        davxml.HRef.fromString(href),
+                        davxml.Status.fromResponseCode(responsecode.FORBIDDEN)))
+                except ConcurrentModification:
                     # This can happen because of a race-condition between the
                     # time we determine which resources exist and the deletion
                     # of one of these resources in another request.  In this
                     # case, return a 404 for the now missing resource rather
                     # than raise an error for the entire report.
                     log.err("Missing resource during multiget: %s" % (href,))
-                    responses.append(davxml.StatusResponse(davxml.HRef.fromString(href), davxml.Status.fromResponseCode(responsecode.NOT_FOUND)))
+                    responses.append(davxml.StatusResponse(
+                        davxml.HRef.fromString(href),
+                        davxml.Status.fromResponseCode(responsecode.NOT_FOUND)
+                    ))
 
             # Indicate error for all valid non-readable resources
             for ignore_resource, href in bad_resources:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20111118/a69d0aca/attachment.html>


More information about the calendarserver-changes mailing list