diff src/bridge/bridge_constructor/bridge_contructor.py @ 423:6c20c76abdcc

backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred - getParams, getParamsForCategory and getParamsUI are now asynchronous primitivus: management of asynchronous getParamsUI
author Goffi <goffi@goffi.org>
date Mon, 07 Nov 2011 00:09:22 +0100
parents 6c167a2e04b8
children 482b9bcf0ca4
line wrap: on
line diff
--- a/src/bridge/bridge_constructor/bridge_contructor.py	Sun Nov 06 15:19:51 2011 +0100
+++ b/src/bridge/bridge_constructor/bridge_contructor.py	Mon Nov 07 00:09:22 2011 +0100
@@ -393,14 +393,14 @@
                 completion['args_result'] = self.getArguments(function['sig_in'], name=arg_doc, unicode_protect=self.options.unicode)
                 completion['async_comma'] = ', ' if async and function['sig_in'] else ''
                 completion['async_args_def'] = 'callback=None, errback=None' if async else ''
-                completion['async_args_call'] = 'callback, lambda arg:errback(GenericException(arg))' if async else ''
+                completion['async_args_call'] = 'callback=callback, errback=errback' if async else ''
                 completion['async_callbacks'] = "('callback', 'errback')" if async else "None"
                 methods_part.append("""\
     @dbus.service.method(const_INT_PREFIX+const_%(category)s_SUFFIX,
                          in_signature='%(sig_in)s', out_signature='%(sig_out)s',
                          async_callbacks=%(async_callbacks)s)
     def %(name)s(self, %(args)s%(async_comma)s%(async_args_def)s):
-        %(debug)sreturn self.cb["%(name)s"](%(args_result)s%(async_comma)s%(async_args_call)s)
+        %(debug)sreturn self._callback("%(name)s", %(args_result)s%(async_comma)s%(async_args_call)s)
 """ % completion)
 
         #at this point, signals_part, methods_part and direct_calls should be filled,