plugin ad-hoc D-Bus: exception fixe + minor fixes

This commit is contained in:
Goffi 2015-09-30 17:24:19 +02:00
commit f52abec673

View file

@ -17,12 +17,12 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
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 @@ class AdHocDBus(object):
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 @@ class AdHocDBus(object):
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 @@ class AdHocDBus(object):
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: