[CalendarServer-changes] [2013] CalendarServer/trunk/twistedcaldav/method

source_changes at macosforge.org source_changes at macosforge.org
Thu Nov 15 09:16:15 PST 2007


Revision: 2013
          http://trac.macosforge.org/projects/calendarserver/changeset/2013
Author:   cdaboo at apple.com
Date:     2007-11-15 09:16:12 -0800 (Thu, 15 Nov 2007)

Log Message:
-----------
Change 405 status response codes to 403 which are more appropriate for the type of error.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/method/copymove.py
    CalendarServer/trunk/twistedcaldav/method/report_multiget.py

Modified: CalendarServer/trunk/twistedcaldav/method/copymove.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/copymove.py	2007-11-15 16:12:15 UTC (rev 2012)
+++ CalendarServer/trunk/twistedcaldav/method/copymove.py	2007-11-15 17:16:12 UTC (rev 2013)
@@ -94,7 +94,7 @@
     if self.isCollection():
         log.err("Attempt to copy a collection into a calendar collection")
         raise HTTPError(StatusResponse(
-            responsecode.NOT_ALLOWED,
+            responsecode.FORBIDDEN,
             "Cannot create collection within special collection %s" % (destination,))
         )
 
@@ -171,14 +171,14 @@
     if destinationcal:
         # Checks for copying a calendar collection
         if self.isCalendarCollection():
-            log.err("Attempt to copy a calendar collection into another calendar collection %s" % destination)
+            log.err("Attempt to move a calendar collection into another calendar collection %s" % destination)
             raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "calendar-collection-location-ok")))
     
         # We also do not allow regular collections in calendar collections
         if self.isCollection():
-            log.err("Attempt to copy a collection into a calendar collection")
+            log.err("Attempt to move a collection into a calendar collection")
             raise HTTPError(StatusResponse(
-                responsecode.NOT_ALLOWED,
+                responsecode.FORBIDDEN,
                 "Cannot create collection within special collection %s" % (destination,)
             ))
 

Modified: CalendarServer/trunk/twistedcaldav/method/report_multiget.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_multiget.py	2007-11-15 16:12:15 UTC (rev 2012)
+++ CalendarServer/trunk/twistedcaldav/method/report_multiget.py	2007-11-15 17:16:12 UTC (rev 2013)
@@ -146,7 +146,7 @@
             for name in valid_names:
                 if name not in exists_names:
                     href = davxml.HRef.fromString(joinURL(request.uri, name))
-                    responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.NOT_ALLOWED)))
+                    responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.FORBIDDEN)))
                 else:
                     checked_names.append(name)
             if not checked_names:
@@ -177,7 +177,7 @@
     
             # Indicate error for all valid non-readable resources
             for ignore_resource, href in bad_resources:
-                responses.append(davxml.StatusResponse(davxml.HRef.fromString(href), davxml.Status.fromResponseCode(responsecode.NOT_ALLOWED)))
+                responses.append(davxml.StatusResponse(davxml.HRef.fromString(href), davxml.Status.fromResponseCode(responsecode.FORBIDDEN)))
     
         doCalendarResponse = deferredGenerator(doCalendarResponse)
 
@@ -214,7 +214,7 @@
                     parent = parent.getResult()
     
                     if not parent.isCalendarCollection() or not parent.index().resourceExists(name):
-                        responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.NOT_ALLOWED)))
+                        responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.FORBIDDEN)))
                         continue
                     
                     # Check privileges on parent - must have at least DAV:read
@@ -223,7 +223,7 @@
                         yield d
                         d.getResult()
                     except AccessDeniedError:
-                        responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.NOT_ALLOWED)))
+                        responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.FORBIDDEN)))
                         continue
                     
                     # Cache the last parent's inherited aces for checkPrivileges optimization
@@ -247,7 +247,7 @@
                     parent = parent.getResult()
     
                     if not parent.isPseudoCalendarCollection() or not parent.index().resourceExists(name):
-                        responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.NOT_ALLOWED)))
+                        responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.FORBIDDEN)))
                         continue
                     child = self
             
@@ -263,7 +263,7 @@
                     yield d
                     d.getResult()
                 except AccessDeniedError:
-                    responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.NOT_ALLOWED)))
+                    responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.FORBIDDEN)))
                     continue
         
                 d = waitForDeferred(report_common.responseForHref(request, responses, href, child, None, propertiesForResource, propertyreq))

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20071115/888d9ae0/attachment-0001.html


More information about the calendarserver-changes mailing list