コード例 #1
0
    def _verify(self):
        if self.request_id and self.in_response_to and \
                        self.in_response_to != self.request_id:
            logger.error("Not the id I expected: %s != %s",
                         self.in_response_to, self.request_id)
            return None

        try:
            assert self.response.version == "2.0"
        except AssertionError:
            _ver = float(self.response.version)
            if _ver < 2.0:
                raise RequestVersionTooLow()
            else:
                raise RequestVersionTooHigh()

        if self.asynchop:
            if self.response.destination and \
                            self.response.destination not in self.return_addrs:
                logger.error("%s not in %s", self.response.destination,
                             self.return_addrs)
                return None

        assert self.issue_instant_ok()
        assert self.status_ok()
        return self
コード例 #2
0
    def _verify(self):
        if self.request_id and self.in_response_to and \
                        self.in_response_to != self.request_id:
            logger.error("Not the id I expected: %s != %s",
                         self.in_response_to, self.request_id)
            return None

        if self.response.version != "2.0":
            _ver = float(self.response.version)
            if _ver < 2.0:
                raise RequestVersionTooLow()
            else:
                raise RequestVersionTooHigh()

        if self.asynchop:
            if (
                self.response.destination
                and self.response.destination not in self.return_addrs
            ):
                logger.error("destination '%s' not in return addresses '%s'", self.response.destination, self.return_addrs)
                return None

        valid = self.issue_instant_ok() and self.status_ok()
        return valid