def notify(self, state, notifications):
        '''
        Call this to schedule sending partner notification.
        '''

        def do_append(desc, notifications):
            for notification in notifications:
                if not isinstance(notification, PendingNotification):
                    raise ValueError("Expected notify() params to be a list "
                                     "of PendingNotification instance, got %r."
                                     % notification)
                key = str(notification.recipient.key)
                if key not in desc.pending_notifications:
                    desc.pending_notifications[key] = list()
                desc.pending_notifications[key].append(notification)

        return state.agent.update_descriptor(do_append, notifications)
def notify ( self , state , notifications ) : def do_append ( desc , notifications ) : for notification in notifications : if not isinstance ( notification , PendingNotification ) : raise ValueError ( "Expected notify() params to be a list " "of PendingNotification instance, got %r." % notification ) key = str ( notification . recipient . key ) if key not in desc . pending_notifications : desc . pending_notifications [ key ] = list ( ) desc . pending_notifications [ key ] . append ( notification ) return state . agent . update_descriptor ( do_append , notifications )
Call this to schedule sending partner notification.