(self, **msgData)
This sends message to listeners of parent topics as well.
        If an exception is raised in a listener, the publish is
        aborted, except if there is a handler (see
        pub.setListenerExcHandler).

        Note that it is important that the PublisherMixin NOT modify any
        state data during message sending, because in principle it could
        happen that a listener causes another message of same topic to be
        sent (presumably, the listener has a way of preventing infinite
        loop).
This sends message to listeners of parent topics as well.
        If an exception is raised in a listener, the publish is
        aborted, except if there is a handler (see
        pub.setListenerExcHandler).
This sends message to listeners of parent topics as well . If an exception is raised in a listener the publish is aborted except if there is a handler ( see pub . setListenerExcHandler ) .
def publish(self, **msgData):
        """
        This sends message to listeners of parent topics as well.
        If an exception is raised in a listener, the publish is
        aborted, except if there is a handler (see
        pub.setListenerExcHandler).

        Note that it is important that the PublisherMixin NOT modify any
        state data during message sending, because in principle it could
        happen that a listener causes another message of same topic to be
        sent (presumably, the listener has a way of preventing infinite
        loop).
        """
        self._treeConfig.notificationMgr.notifySend('pre', self)

        # check the message data:
        if self.__validator is not None:
            self._getListenerSpec().check(msgData)
        else:
            assert not self.hasListeners()

        # get the list of topics from self to root (ALL_TOPICS)
        topicStack = [self]
        parent = self.__parentTopic
        while parent is not None:
            parent = parent()
            topicStack.append(parent)
            parent = parent.__parentTopic  # deref weakref

        # for each topic, send to listeners:
        msgDataSubset = {}
        for topicObj in reversed(topicStack):
            added_args = topicObj.__msgArgs.argsAddedToParent
            add_to_parent = {k: msgData[k] for k in added_args if k in msgData}
            msgDataSubset.update(add_to_parent)
            if topicObj.hasListeners():
                self.__sendMessage(msgData, topicObj, msgDataSubset)

        self._treeConfig.notificationMgr.notifySend('post', self)
def publish ( self , * * msgData ) : self . _treeConfig . notificationMgr . notifySend ( 'pre' , self ) # check the message data: if self . __validator is not None : self . _getListenerSpec ( ) . check ( msgData ) else : assert not self . hasListeners ( ) # get the list of topics from self to root (ALL_TOPICS) topicStack = [ self ] parent = self . __parentTopic while parent is not None : parent = parent ( ) topicStack . append ( parent ) parent = parent . __parentTopic # deref weakref # for each topic, send to listeners: msgDataSubset = { } for topicObj in reversed ( topicStack ) : added_args = topicObj . __msgArgs . argsAddedToParent add_to_parent = { k : msgData [ k ] for k in added_args if k in msgData } msgDataSubset . update ( add_to_parent ) if topicObj . hasListeners ( ) : self . __sendMessage ( msgData , topicObj , msgDataSubset ) self . _treeConfig . notificationMgr . notifySend ( 'post' , self )