dbus/test/python test-client.py,1.14,1.15 test-service.py,1.7,1.8

Robert McQueen robot101 at freedesktop.org
Sun Nov 13 18:53:32 PST 2005


Update of /cvs/dbus/dbus/test/python
In directory gabe:/tmp/cvs-serv28091/test/python

Modified Files:
	test-client.py test-service.py 
Log Message:
2005-11-14  Robert McQueen  <robot101 at debian.org>

	* python/decorators.py, python/service.py: Add a new argument to the
	dbus.service.method decorator called sender_keyword, which if set,
	specifies the name of an argument which will be provided the bus
	name of the method caller.

	* test/python/test-client.py, test/python/test-service.py: Add a
	method and test to check the sender_keyword functionality.

Index: test-client.py
===================================================================
RCS file: /cvs/dbus/dbus/test/python/test-client.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- test-client.py	7 Nov 2005 15:31:30 -0000	1.14
+++ test-client.py	14 Nov 2005 02:53:29 -0000	1.15
@@ -218,6 +218,11 @@
             self.assert_(private_type != private_func, '%s should not equal %s' % (private_type, private_func))
             self.assert_(private_func != private_cls, '%s should not equal %s' % (private_func, private_cls))
 
+    def testSenderName(self):
+        print '\n******** Testing sender name keyword ********'
+        myself = self.iface.WhoAmI()
+        print "I am", myself
+
     def testBusNameCreation(self):
         print '\n******** Testing BusName creation ********'
         test = [('org.freedesktop.DBus.Python.TestName', True),

Index: test-service.py
===================================================================
RCS file: /cvs/dbus/dbus/test/python/test-service.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- test-service.py	7 Nov 2005 15:31:30 -0000	1.7
+++ test-service.py	14 Nov 2005 02:53:30 -0000	1.8
@@ -130,6 +130,10 @@
         except Exception, e:
             error_cb(e)
 
+    @dbus.service.method('org.freedesktop.DBus.TestSuiteInterface', in_signature='', out_signature='s', sender_keyword='sender')
+    def WhoAmI(self, sender):
+        return sender
+
 session_bus = dbus.SessionBus()
 name = dbus.service.BusName("org.freedesktop.DBus.TestSuitePythonService", bus=session_bus)
 object = TestObject(name)



More information about the dbus-commit mailing list