Commits

Anonymous committed 677cf8c

Add some WebDAV response codes. And remove a bit of dead code as noted by Jacob Smullyan

  • Participants
  • Parent commits 058e39a

Comments (0)

Files changed (1)

         body_tmpl = self.body_template_obj
         if HTTPException.body_template_obj is not self.body_template_obj:
             # Custom template; add headers to args
-            req = Request(environ)
             for k, v in environ.items():
                 args[k] = escape(v)
             for k, v in self.headers.items():
     code = 206
     title = 'Partial Content'
 
+## FIXME: add 207 Multi-Status (but it's complicated)
+
 ############################################################
 ## 3xx redirection
 ############################################################
     title = 'Expectation Failed'
     explanation = ('Expectation failed.')
 
+class HTTPUnprocessableEntity(HTTPClientError):
+    ## Note: from WebDAV
+    code = 422
+    title = 'Unprocessable Entity'
+    explanation = 'Unable to process the contained instructions'
+
+class HTTPLocked(HTTPClientError):
+    ## Note: from WebDAV
+    code = 423
+    title = 'Locked'
+    explanation = ('The resource is locked')
+
+class HTTPFailedDependency(HTTPClientError):
+    ## Note: from WebDAV
+    code = 424
+    title = 'Failed Dependency'
+    explanation = ('The method could not be performed because the requested '
+                   'action dependended on another action and that action failed')
+
 ############################################################
 ## 5xx Server Error
 ############################################################
     title = 'HTTP Version Not Supported'
     explanation = ('The HTTP version is not supported.')
 
+class HTTPInsufficientStorage(HTTPServerError):
+    code = 507
+    title = 'Insufficient Storage'
+    explanation = ('There was not enough space to save the resource')
+
 class HTTPExceptionMiddleware(object):
     """
     Middleware that catches exceptions in the sub-application.  This