# HG changeset patch # User Goffi # Date 1452707072 -3600 # Node ID b0ed4863dbc705cd905187b3250cfd40359a2580 # Parent f39ca283277452e823795c19600f1bff8deeedb9 bridge (D-Bus): fixed handling of profile in kwargs: kwargs are not handled by python D-Bus (i.e. they are not sent through D-Bus). The "profile" and "profile_key" kwargs are often used through SàT with the bridge, this was working so far because they were used for core methods (which have a signature in DBus.py handling profile), or in Libervia browser who ignore profile argument. But if the profile or profile_key was used as a keyword for plugin method outside of Libervia browser, they were ignored, this commit fix this by adding them to the args list. diff -r f39ca2832774 -r b0ed4863dbc7 frontends/src/bridge/DBus.py --- a/frontends/src/bridge/DBus.py Wed Jan 13 18:15:20 2016 +0100 +++ b/frontends/src/bridge/DBus.py Wed Jan 13 18:44:32 2016 +0100 @@ -100,15 +100,25 @@ # - or if the last two arguments are callable async = False + args = list(args) if kwargs: if 'callback' in kwargs: async = True _callback = kwargs.pop('callback') _errback = kwargs.pop('errback', lambda failure: log.error(unicode(failure))) + try: + args.append(kwargs.pop('profile')) + except KeyError: + try: + args.append(kwargs.pop('profile_key')) + except KeyError: + pass + # at this point, kwargs should be empty + if kwargs: + log.warnings(u"unexpected keyword arguments, they will be ignored: {}".format(kwargs)) elif len(args) >= 2 and callable(args[-1]) and callable(args[-2]): async = True - args = list(args) _errback = args.pop() _callback = args.pop() diff -r f39ca2832774 -r b0ed4863dbc7 src/bridge/bridge_constructor/dbus_frontend_template.py --- a/src/bridge/bridge_constructor/dbus_frontend_template.py Wed Jan 13 18:15:20 2016 +0100 +++ b/src/bridge/bridge_constructor/dbus_frontend_template.py Wed Jan 13 18:44:32 2016 +0100 @@ -100,15 +100,25 @@ # - or if the last two arguments are callable async = False + args = list(args) if kwargs: if 'callback' in kwargs: async = True _callback = kwargs.pop('callback') _errback = kwargs.pop('errback', lambda failure: log.error(unicode(failure))) + try: + args.append(kwargs.pop('profile')) + except KeyError: + try: + args.append(kwargs.pop('profile_key')) + except KeyError: + pass + # at this point, kwargs should be empty + if kwargs: + log.warnings(u"unexpected keyword arguments, they will be ignored: {}".format(kwargs)) elif len(args) >= 2 and callable(args[-1]) and callable(args[-2]): async = True - args = list(args) _errback = args.pop() _callback = args.pop()