示例#1
0
    def handleProcessed(self, message):
        """
        Removes a processed message from the queue of sent messages
        and performs message finalization.
        """

        # Remove message from list of sent messages.
        self.sent_messages.remove(message)

        # Disconnect messages processed signal.
        message.processed.disconnect(self.handleProcessed)

        # Call message finalizer.
        message.finalize()

        # Always exit on exceptions in strict mode.
        if self.strict and message.hasErrors():
            for m_error in message.getErrors():
                if m_error.hasException():
                    m_error.printException()
                    self.cleanUp()
                    return

        # Notify the sender if errors occured while processing the
        # message and exit if the sender doesn't handle the error.
        if message.hasErrors():
            if not message.getSource().handleErrors(sent_message):
                self.cleanUp()
                return

        # Check the responses if we are in strict mode.
        if self.strict:
            validator = halMessage.valid_messages[message.m_type].get("resp")
            for response in message.getResponses():
                halMessage.validateResponse(validator, message, response)

        # Notify the sender of any responses to the message.
        message.getSource().handleResponses(message)

        # Print a warning if the message was 'get functionality'
        # and there were no responses.
        if message.isType("get functionality") and not message.hasResponses():
            print(">> Warning functionality '" + message.getData()["name"] +
                  "' not found!")
            hdebug.logText("no functionality " + message.getData()["name"])

        # Start message processing timer in case there are other messages
        # waiting for this message to get finalized.
        self.startMessageTimer()
示例#2
0
    def handleProcessed(self, message):
        """
        Removes a processed message from the queue of sent messages
        and performs message finalization.
        """

        # Remove message from list of sent messages.
        self.sent_messages.remove(message)

        # Disconnect messages processed signal.
        message.processed.disconnect(self.handleProcessed)
        
        # Call message finalizer.
        message.finalize()

        # Always exit on exceptions in strict mode.
        if self.strict and message.hasErrors():
            for m_error in message.getErrors():
                if m_error.hasException():
                    m_error.printException()
                    self.cleanUp()
                    return

        # Notify the sender if errors occured while processing the
        # message and exit if the sender doesn't handle the error.
        if message.hasErrors():
            if not message.getSource().handleErrors(sent_message):
                self.cleanUp()
                return

        # Check the responses if we are in strict mode.
        if self.strict:
            validator = halMessage.valid_messages[message.m_type].get("resp")
            for response in message.getResponses():
                halMessage.validateResponse(validator, message, response)

        # Notify the sender of any responses to the message.
        message.getSource().handleResponses(message)

        # Print a warning if the message was 'get functionality'
        # and there were no responses.
        if message.isType("get functionality") and not message.hasResponses():
            print(">> Warning functionality '" + message.getData()["name"] + "' not found!")
            hdebug.logText("no functionality " + message.getData()["name"])

        # Start message processing timer in case there are other messages
        # waiting for this message to get finalized.
        self.startMessageTimer()