[Twisted-Python] notifyOnDisconnect

Hello. I have server and a lot of clients, that connects to server and pass their pb.Referenceable. Every 2 minutes server calls clients' remote method. I store clients' references on server in a list of dictionaries - [{'remoteRef' : ref, 'ip' : '192.168.1.2', 'mac' : '...'}, ....] I call notifyOnDisconnect on clients' remoteRef. In callback i need to close client's firewall. How can i pass 'ip', 'mac' from dictionary to callback if notifyOnDisconnect passes only one parameter(this instance) to callback method. Help, please Thanks in advance Best regards, Ruslan

On Fri, 05 Sep 2003 12:20:20 +0300 Ruslan Spivak <alienoid@is.lg.ua> wrote:
I have server and a lot of clients, that connects to server and pass their pb.Referenceable. Every 2 minutes server calls clients' remote method. I store clients' references on server in a list of dictionaries - [{'remoteRef' : ref, 'ip' : '192.168.1.2', 'mac' : '...'}, ....] I call notifyOnDisconnect on clients' remoteRef. In callback i need to close client's firewall. How can i pass 'ip', 'mac' from dictionary to callback if notifyOnDisconnect passes only one parameter(this instance) to callback method. Help, please
notifyOnDisconnect(lambda x: x.disconnected({'remoteRef' : ref, 'ip' : '192.168.1.2', 'mac' : '...'}) or maybe notifyOnDisconnect(lambda: x.disconnected({'remoteRef' : ref, 'ip' : '192.168.1.2', 'mac' : '...'}) depending on the required signature. Use a lambda, anyway. -- Itamar Shtull-Trauring http://itamarst.org/ Available for Python & Twisted consulting
participants (2)
-
Itamar Shtull-Trauring
-
Ruslan Spivak