# HG changeset patch # User Goffi # Date 1443626659 -7200 # Node ID 9a4e95c62380a0a3a9db087907877634f18fbb5b # Parent 98f92a054539e893d2d71438a97944a5874b97f6 plugin ad-hoc D-Bus: exception fixe + minor fixes diff -r 98f92a054539 -r 9a4e95c62380 src/plugins/plugin_adhoc_dbus.py --- a/src/plugins/plugin_adhoc_dbus.py Tue Sep 29 20:19:43 2015 +0200 +++ b/src/plugins/plugin_adhoc_dbus.py Wed Sep 30 17:24:19 2015 +0200 @@ -17,12 +17,12 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from sat.core.i18n import _, D_ +from sat.core.i18n import _ from sat.core.constants import Const as C from sat.core.log import getLogger log = getLogger(__name__) -from twisted.words.protocols.jabber import jid -from twisted.internet import defer, reactor +from sat.core import exceptions +from twisted.internet import defer from wokkel import data_form from lxml import etree from os import path @@ -103,7 +103,7 @@ el = etree.fromstring(introspect_xml) for node in el.iterchildren('node', 'interface'): if node.tag == 'node': - new_path = path.join(proxy.object_path, node.get('name')) + new_path = os.path.join(proxy.object_path, node.get('name')) new_proxy = self.session_bus.get_object(bus_name, new_path, introspect=False) yield self._introspect(methods, bus_name, new_proxy) elif node.tag == 'interface': @@ -183,7 +183,7 @@ x_elt = command_elt.elements(data_form.NS_X_DATA,'x').next() answer_form = data_form.Form.fromElement(x_elt) command = answer_form['command'] - except KeyError, StopIteration: + except (KeyError, StopIteration): raise self.XEP_0050.AdHocError(self.XEP_0050.ERROR.BAD_PAYLOAD) if command not in names_map: @@ -192,7 +192,7 @@ path, iface, command = names_map[command] proxy = self.session_bus.get_object(bus_name, path) - d = self._DBusAsyncCall(proxy, command, interface=iface) + self._DBusAsyncCall(proxy, command, interface=iface) # job done, we can end the session, except if we have FLAG_LOOP if FLAG_LOOP in flags: