Exemple #1
0
    def _check_response(self, response):
        query = self.request
        term = query.term
        opts = query.global_optargs
        self._check_error_response(response, term)
        if response.type in SequenceResponse:
            # Sequence responses
            value = Cursor(self, query, opts)
            value._extend(response)
        elif response.type == pResponse.SUCCESS_ATOM:
            # Atom response
            if len(response.data) < 1:
                value = None
            value = recursively_convert_pseudotypes(response.data[0], opts)
        elif response.type == pResponse.WAIT_COMPLETE:
            # Noreply_wait response
            return None
        else:
            # Default for unknown response types
            raise RqlDriverError("Unknown Response type %d encountered in "
                                 "response." % response.type)

        if response.profile is not None:
            value = {"value": value, "profile": response.profile}

        return value
Exemple #2
0
    def _extend(self, res_buf):
        Cursor._extend(self, res_buf)

        if self.error is not None:
            self.items.cancel_getters(self.error)

        for d in self.waiting[:]:
            d.callback(None)
            self.waiting.remove(d)
Exemple #3
0
 def _extend(self, res_buf):
     Cursor._extend(self, res_buf)
     self.new_response.set_result(True)
     self.new_response = asyncio.Future()