def queryCollection(self, rurl, timerange, start, end, expand, props=()):

        assert(isinstance(rurl, URL))

        hrefs = set()

        # Create CalDAV query REPORT
        if timerange:
            request = QueryVEVENTTimeRange(self, rurl.relativeURL(), start, end, expand, props=props)
        else:
            raise NotImplementedError
        result = ResponseDataString()
        request.setOutput(result)

        # Process it
        self.runSession(request)

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

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

            # Look at each propfind result
            for item in parser.getResults().itervalues():

                # Get child element name (decode URL)
                name = URL(url=item.getResource(), decode=True)
                hrefs.add(name)

        else:
            self.handleHTTPError(request)

        return hrefs
Beispiel #2
0
    def doRequest(self):
        """
        Execute the actual HTTP request.
        """
        props = (
            davxml.getetag,
            davxml.getcontenttype,
        )

        # Create CalDAV query
        request = QueryVEVENTTimeRange(self.sessions[0],
                                       self.sessions[0].calendarHref,
                                       self.start.getText(),
                                       self.end.getText(), 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("Query request failed: %s" %
                               (request.getStatusCode(), ))
Beispiel #3
0
    def doRequest(self):
        """
        Execute the actual HTTP request.
        """
        props = (
            davxml.getetag,
            davxml.getcontenttype,
        )

        # Create CalDAV query
        request = QueryVEVENTTimeRange(self.sessions[0], self.sessions[0].calendarHref, self.start.getText(), self.end.getText(), 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("Query request failed: %s" % (request.getStatusCode(),))
Beispiel #4
0
    def queryCollection(self, rurl, timerange, start, end, expand, props=()):

        assert (isinstance(rurl, URL))

        hrefs = set()

        # Create CalDAV query REPORT
        if timerange:
            request = QueryVEVENTTimeRange(self,
                                           rurl.relativeURL(),
                                           start,
                                           end,
                                           expand,
                                           props=props)
        else:
            raise NotImplementedError
        result = ResponseDataString()
        request.setOutput(result)

        # Process it
        self.runSession(request)

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

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

            # Look at each propfind result
            for item in parser.getResults().itervalues():

                # Get child element name (decode URL)
                name = URL(url=item.getResource(), decode=True)
                hrefs.add(name)

        else:
            self.handleHTTPError(request)

        return hrefs