[telepathy-doc/master] Use lambda to do what I want. I should think more like a Python programmer

Danielle Madeley danielle.madeley at collabora.co.uk
Thu Nov 12 02:15:29 PST 2009


---
 docs/examples/python_mc5_clients/handler.py |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/docs/examples/python_mc5_clients/handler.py b/docs/examples/python_mc5_clients/handler.py
index 6e68e08..8fe1eaf 100644
--- a/docs/examples/python_mc5_clients/handler.py
+++ b/docs/examples/python_mc5_clients/handler.py
@@ -78,11 +78,12 @@ class ExampleHandler(telepathy.server.ClientObserver,
             channel = telepathy.client.Channel(service_name, object_path)
             self._channels.append(channel)
             channel[CHANNEL_TYPE_DBUS_TUBE].Accept(SOCKET_ACCESS_CONTROL_LOCALHOST)
-            channel[CHANNEL].connect_to_signal('Closed', self.channel_closed)
+            channel[CHANNEL].connect_to_signal('Closed',
+                lambda: self.channel_closed(channel))
 
-    def channel_closed(self):
-        # FIXME: remove from self._channels
-        pass
+    def channel_closed(self, channel):
+        print "Remove channel", channel.object_path
+        self._channels.remove(channel)
 
 
 def publish(client_name):
-- 
1.5.6.5



More information about the telepathy-commits mailing list