[telepathy-ashes/master] Added the ability to make object strings useful.

David Laban david.laban at collabora.co.uk
Wed Oct 7 04:35:55 PDT 2009


Many methods return object paths which implicitely reference objects on
the current connection. Just added a convenience function to turn these
into InterfaceFactory objects.
---
 ashes/tools/bases.py |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/ashes/tools/bases.py b/ashes/tools/bases.py
index e367702..1a9fb6b 100644
--- a/ashes/tools/bases.py
+++ b/ashes/tools/bases.py
@@ -37,6 +37,16 @@ class ObjectListener(object):
         """Enables InterfaceFactory gumph."""
         return self.dbus_object[iface]
 
+    def get_related_object(self, object_path, interface):
+        """
+        Quite often, object paths are returned as strings. This will convert
+        them to objects that you can actually use (InterfaceFactory objects).
+        """
+        conn = self.dbus_object.dbus_proxy._bus
+        bus_name = self.service_name
+        dbus_object = dbus.proxies.ProxyObject(conn, bus_name, object_path)
+        iface = telepathy.client.InterfaceFactory(dbus_object, interface)
+        return iface
 
     def connect_to_signal(self, iface_name, signal_name):
         """
-- 
1.5.6.5




More information about the telepathy-commits mailing list