示例#1
0
    def doRequest(self):
        """
        Execute the actual HTTP request.
        """
        hrefs = [
            joinURL(self.sessions[0].calendarHref, "%d.ics" % (i + 1, ))
            for i in range(self.count)
        ]
        props = (
            davxml.getetag,
            caldavxml.calendar_data,
            caldavxml.schedule_tag,
        )

        # Create CalDAV multiget
        request = Multiget(self.sessions[0], self.sessions[0].calendarHref,
                           hrefs, props)
        result = ResponseDataString()
        request.setOutput(result)

        # Process it
        self.sessions[0].runSession(request)

        # If its a 207 we want to parse the XML
        if request.getStatusCode() == statuscodes.MultiStatus:
            pass
        else:
            raise RuntimeError("Muliget request failed: %s" %
                               (request.getStatusCode(), ))
    def calendarMultiGet(self, rurl, hrefs, props):
        """
        Fetches the specified props for the specified hrefs using a single
        multiget call. The return value is a dictionary where the keys are the
        hrefs and the values are PropFindResult objects containing results for
        the requested props.
        """

        assert(isinstance(rurl, URL))

        request = CalMultiget(self, rurl.relativeURL(), hrefs=hrefs, props=props)
        result = ResponseDataString()
        request.setOutput(result)

        # Process it
        self.runSession(request)

        # If it's a 207 we want to parse the XML
        if request.getStatusCode() == statuscodes.MultiStatus:

            parser = PropFindParser()
            parser.parseData(result.getData())
            return parser.getResults()

        else:
            self.handleHTTPError(request)
            return None
示例#3
0
    def calendarMultiGet(self, rurl, hrefs, props):
        """
        Fetches the specified props for the specified hrefs using a single
        multiget call. The return value is a dictionary where the keys are the
        hrefs and the values are PropFindResult objects containing results for
        the requested props.
        """

        assert (isinstance(rurl, URL))

        request = CalMultiget(self,
                              rurl.relativeURL(),
                              hrefs=hrefs,
                              props=props)
        result = ResponseDataString()
        request.setOutput(result)

        # Process it
        self.runSession(request)

        # If it's a 207 we want to parse the XML
        if request.getStatusCode() == statuscodes.MultiStatus:

            parser = PropFindParser()
            parser.parseData(result.getData())
            return parser.getResults()

        else:
            self.handleHTTPError(request)
            return None
示例#4
0
    def doRequest(self):
        """
        Execute the actual HTTP request.
        """
        hrefs = [joinURL(self.sessions[0].calendarHref, "%d.ics" % (i+1,)) for i in range(self.count)]
        props = (
            davxml.getetag,
            caldavxml.calendar_data,
            caldavxml.schedule_tag,
        )

        # Create CalDAV multiget
        request = Multiget(self.sessions[0], self.sessions[0].calendarHref, hrefs, props)
        result = ResponseDataString()
        request.setOutput(result)
    
        # Process it
        self.sessions[0].runSession(request)
    
        # If its a 207 we want to parse the XML
        if request.getStatusCode() == statuscodes.MultiStatus:
            pass
        else:
            raise RuntimeError("Muliget request failed: %s" % (request.getStatusCode(),))