diff --git a/frontends/src/bridge/DBus.py b/frontends/src/bridge/DBus.py index f33077d9..ab9467ad 100644 --- a/frontends/src/bridge/DBus.py +++ b/frontends/src/bridge/DBus.py @@ -100,15 +100,25 @@ class DBusBridgeFrontend(BridgeFrontend): # - 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 --git a/src/bridge/bridge_constructor/dbus_frontend_template.py b/src/bridge/bridge_constructor/dbus_frontend_template.py index de3dfc1f..4567cd33 100644 --- a/src/bridge/bridge_constructor/dbus_frontend_template.py +++ b/src/bridge/bridge_constructor/dbus_frontend_template.py @@ -100,15 +100,25 @@ class DBusBridgeFrontend(BridgeFrontend): # - 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()