diff options
author | Robert McQueen <robot101@debian.org> | 2005-11-04 12:18:00 +0000 |
---|---|---|
committer | Robert McQueen <robot101@debian.org> | 2005-11-04 12:18:00 +0000 |
commit | ac36149533cdf3131dec3f43a7e9ea1ee11937f5 (patch) | |
tree | cc5a2cf3836d43ab52959d3b95b1fee04dbf510d /test/python/test-service.py | |
parent | e20c311b131246019ade0c964596a7fda758de68 (diff) |
2005-11-04 Robert McQueen <robot101@debian.org>
* python/dbus_bindings.pyx, test/python/test-client.py: Fix
marshalling of boolean values. Add some booleans to the values in
the test client.
* python/decorators.py, python/service.py: Add an 'async_callbacks'
argument to the dbus.service.method decorator, which allows you to
name arguments to take two callback functions for replying with
return values or an exception.
* test/python/test-client.py, test/python/test-service.py: Add test
case using asynchronous method reply functions, both return values and
errors, and from within both the function itself and from a mainloop
callback.
* python/decorators.py, python/service.py: Perform checking that the
number of method/signal arguments matches the number of types in the
signature at class loading time, not when you first introspect the
class.
* python/service.py: Remove debug print left by the last commit.
Diffstat (limited to 'test/python/test-service.py')
-rwxr-xr-x | test/python/test-service.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/python/test-service.py b/test/python/test-service.py index ecb9fd60..820514ae 100755 --- a/test/python/test-service.py +++ b/test/python/test-service.py @@ -80,6 +80,22 @@ class TestObject(dbus.service.Object, TestInterface): def CheckInheritance(self): return True + @dbus.service.method('org.freedesktop.DBus.TestSuiteInterface', in_signature='bbv', out_signature='v', async_callbacks=('return_cb', 'error_cb')) + def AsynchronousMethod(self, async, fail, variant, return_cb, error_cb): + try: + if async: + gobject.timeout_add(500, self.AsynchronousMethod, False, fail, variant, return_cb, error_cb) + return + else: + if fail: + raise RuntimeError + else: + return_cb(variant) + + return False # do not run again + except Exception, e: + error_cb(e) + session_bus = dbus.SessionBus() name = dbus.service.BusName("org.freedesktop.DBus.TestSuitePythonService", bus=session_bus) object = TestObject(name) |