OPSI.web2.dav.http module

HTTP Utilities

class OPSI.web2.dav.http.ErrorResponse(code, error)

Bases: OPSI.web2.http.Response

A L{Response} object which contains a status code and a L{davxml.Error} element. Renders itself as a DAV:error XML document.

error = None
class OPSI.web2.dav.http.MultiStatusResponse(xml_responses)

Bases: OPSI.web2.http.Response

Multi-status L{Response} object. Renders itself as a DAV:multi-status XML document.

class OPSI.web2.dav.http.ResponseQueue(path_basename, method, success_response)

Bases: object

Stores a list of (typically error) responses for use in a L{MultiStatusResponse}.

add(path, what)

Add a response. @param path: a path, which must be a subpath of C{path_basename} as

provided to L{__init__}.

@param what: a status code or a L{Failure} for the given path.

response()

Generate a L{MultiStatusResponse} with the responses contained in the queue or, if no such responses, return the C{success_response} provided to L{__init__}. @return: the response.

class OPSI.web2.dav.http.PropertyStatusResponseQueue(method, uri, success_response)

Bases: object

Stores a list of propstat elements for use in a L{Response} in a L{MultiStatusResponse}.

add(what, property)

Add a response. @param what: a status code or a L{Failure} for the given path. @param property: the property whose status is being reported.

error()

Convert any 2xx codes in the propstat responses to 424 Failed Dependency.

response()

Generate a response from the responses contained in the queue or, if there are no such responses, return the C{success_response} provided to L{__init__}. @return: a L{davxml.PropertyStatusResponse}.

OPSI.web2.dav.http.statusForFailure(failure, what=None)

@param failure: a L{Failure}. @param what: a decription of what was going on when the failure occurred.

If what is not C{None}, emit a cooresponding message via L{log.err}.

@return: a response code cooresponding to the given C{failure}.