Пример #1
0
    def send_msg_func_with_return(self, cmd):
        """Send a command message to the remote Spec server using the new 'func' feature, and return the reply id.

        Arguments:
        cmd -- command string
        """
        if self.serverVersion < 3:
            logging.getLogger('SpecClient').error('Cannot execute command in Spec : feature is available since Spec server v3 only')
        else:
            if self.isSpecConnected():
                try:
                    caller = sys._getframe(1).f_locals['self']
                except KeyError:
                    caller = None

                message = SpecMessage.msg_func_with_return(cmd, version = self.serverVersion)
                return self.__send_msg_with_reply(replyReceiverObject = caller, *message)
            else:
                raise SpecClientNotConnectedError
Пример #2
0
    def send_msg_func_with_return(self, cmd):
        """Send a command message to the remote Spec server using the new 'func' feature, and return the reply id.

        Arguments:
        cmd -- command string
        """
        if self.serverVersion < 3:
            log.error(
                'Cannot execute command in Spec : feature is available since Spec server v3 only'
            )
        else:
            if self.isSpecConnected():
                try:
                    caller = sys._getframe(1).f_locals['self']
                except KeyError:
                    caller = None

                message = SpecMessage.msg_func_with_return(
                    cmd, version=self.serverVersion)
                return self.__send_msg_with_reply(replyReceiverObject=caller,
                                                  *message)
            else:
                raise SpecClientNotConnectedError
Пример #3
0
    def send_msg_func_with_return(self, cmd, caller=None):
        """Send a command message to the remote Spec server using the new 'func' feature, and return the reply id.

        Arguments:
        cmd -- command string
        """
        if self.server_version < 3:
            raise SpecClientVersionError("need spec server minimum version 3")

        if not self.is_connected():
            raise SpecClientNotConnectedError

        if caller is None:
            try:
                caller = sys._getframe(1).f_locals['self']
            except KeyError:
                caller = None
        log.log(2,
                "executing command. reply to be informed to %s" % str(caller))

        reply, msg = SpecMessage.msg_func_with_return(
            cmd, version=self.server_version)
        reply_id = self.__send_msg_with_reply(reply, msg, receiver_obj=caller)
        return reply_id