Exemple #1
0
    def __init__(self, xml_responses):
        """
        @param xml_responses: an interable of davxml.Response objects.
        """
        multistatus = davxml.MultiStatus(*xml_responses)
        output = multistatus.toxml()

        Response.__init__(self, code=responsecode.MULTI_STATUS,
                          stream=davxml.MultiStatus(*xml_responses).toxml())

        self.headers.setHeader("content-type", MimeType("text", "xml"))
Exemple #2
0
    def __init__(self, code, error):
        """
        @param code: a response code.
        @param error: an L{davxml.WebDAVElement} identifying the error, or a
            tuple C{(namespace, name)} with which to create an empty element
            denoting the error.  (The latter is useful in the case of
            preconditions ans postconditions, not all of which have defined
            XML element classes.)
        """
        if type(error) is tuple:
            xml_namespace, xml_name = error
            class EmptyError (davxml.WebDAVEmptyElement):
                namespace = xml_namespace
                name      = xml_name
            error = EmptyError()

        output = davxml.Error(error).toxml()

        Response.__init__(self, code=code, stream=output)

        self.headers.setHeader("content-type", MimeType("text", "xml"))

        self.error = error