diff src/bridge/bridge_constructor/bridge_constructor.py @ 1024:7e43ea75cce8

bridge (constructor): fixed D-Bus frontend generator for async method without sig_in + fixed --debug option + regenerated bridge to fix bad frontend D-Bus bridge.
author Goffi <goffi@goffi.org>
date Thu, 15 May 2014 16:35:28 +0200
parents 1fe00f0c9a91
children 95758ef3faa8
line wrap: on
line diff
--- a/src/bridge/bridge_constructor/bridge_constructor.py	Thu May 15 16:02:16 2014 +0200
+++ b/src/bridge/bridge_constructor/bridge_constructor.py	Thu May 15 16:35:28 2014 +0200
@@ -40,7 +40,6 @@
 
 import sys
 import os
-from os import path
 from optparse import OptionParser
 from ConfigParser import SafeConfigParser as Parser
 from ConfigParser import NoOptionError
@@ -373,7 +372,7 @@
                 'args': self.getArguments(function['sig_in'], name=arg_doc, default=default)}
 
             if function["type"] == "signal":
-                completion['body'] = "pass" if not self.options.debug else 'debug ("%s")' % section
+                completion['body'] = "pass" if not self.options.debug else 'log.debug ("%s")' % section
                 signals_part.append("""\
     @dbus.service.signal(const_INT_PREFIX+const_%(category)s_SUFFIX,
                          signature='%(sig_in)s')
@@ -386,7 +385,7 @@
 """ % completion)
 
             elif function["type"] == "method":
-                completion['debug'] = "" if not self.options.debug else 'debug ("%s")\n%s' % (section, 8 * ' ')
+                completion['debug'] = "" if not self.options.debug else 'log.debug ("%s")\n%s' % (section, 8 * ' ')
                 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 ''
@@ -447,15 +446,15 @@
                 'args': self.getArguments(function['sig_in'], name=arg_doc, default=default)}
 
             if function["type"] == "method":
-                completion['debug'] = "" if not self.options.debug else 'debug ("%s")\n%s' % (section, 8 * ' ')
+                completion['debug'] = "" if not self.options.debug else 'log.debug ("%s")\n%s' % (section, 8 * ' ')
                 completion['args_result'] = self.getArguments(function['sig_in'], name=arg_doc)
-                completion['async_args'] = ', callback=None, errback=None' if async else ''
+                completion['async_args'] = 'callback=None, errback=None' if async else ''
                 completion['async_comma'] = ', ' if async and function['sig_in'] else ''
                 completion['async_args_result'] = 'reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])' if async else ''
                 result = "self.db_%(category)s_iface.%(name)s(%(args_result)s%(async_comma)s%(async_args_result)s)" % completion
                 completion['result'] = ("unicode(%s)" if self.options.unicode and function['sig_out'] == 's' else "%s") % result
                 methods_part.append("""\
-    def %(name)s(self, %(args)s%(async_args)s):
+    def %(name)s(self, %(args)s%(async_comma)s%(async_args)s):
         %(debug)sreturn %(result)s
 """ % completion)