Esempio n. 1
0
    def __call__(self):
        request_body = self.request.get("BODY")
        prop_mode, properties = parse_property_request(request_body)
        names_only = prop_mode == PROP_PROPNAMES

        document = etree.Element("{DAV:}multistatus", nsmap=NAMESPACES)
        generator = getAdapter(self.request, IPROPFINDDocumentGenerator)

        for obj in self.get_requested_objects():
            provider = getMultiAdapter((obj, self.request), ICalDAVProperties)
            generator.add_response(document, provider, select_properties=properties, names_only=names_only)

        return etree.tostring(document, pretty_print=True)
Esempio n. 2
0
    def generate(self, property_providers, subobjects=None):
        names_only = False
        prop_mode, properties = parse_property_request(self.request.get('BODY'))

        if prop_mode == PROP_PROPNAMES:
            names_only = True

        document = self.create_document()
        for provider in property_providers:
            self.add_response(document,
                              provider,
                              select_properties=properties,
                              names_only=names_only)

        response = self.request.RESPONSE
        response.setStatus(207)
        response.setHeader('Content-Type', 'text/xml; charset="utf-8"')
        response.setBody(etree.tostring(document, pretty_print=True))
        return response