plugin ad-hoc D-Bus: exception fixe + minor fixes
This commit is contained in:
parent
07e8942ba9
commit
f52abec673
1 changed files with 6 additions and 6 deletions
|
|
@ -17,12 +17,12 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# 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.constants import Const as C
|
||||||
from sat.core.log import getLogger
|
from sat.core.log import getLogger
|
||||||
log = getLogger(__name__)
|
log = getLogger(__name__)
|
||||||
from twisted.words.protocols.jabber import jid
|
from sat.core import exceptions
|
||||||
from twisted.internet import defer, reactor
|
from twisted.internet import defer
|
||||||
from wokkel import data_form
|
from wokkel import data_form
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
from os import path
|
from os import path
|
||||||
|
|
@ -103,7 +103,7 @@ class AdHocDBus(object):
|
||||||
el = etree.fromstring(introspect_xml)
|
el = etree.fromstring(introspect_xml)
|
||||||
for node in el.iterchildren('node', 'interface'):
|
for node in el.iterchildren('node', 'interface'):
|
||||||
if node.tag == 'node':
|
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)
|
new_proxy = self.session_bus.get_object(bus_name, new_path, introspect=False)
|
||||||
yield self._introspect(methods, bus_name, new_proxy)
|
yield self._introspect(methods, bus_name, new_proxy)
|
||||||
elif node.tag == 'interface':
|
elif node.tag == 'interface':
|
||||||
|
|
@ -183,7 +183,7 @@ class AdHocDBus(object):
|
||||||
x_elt = command_elt.elements(data_form.NS_X_DATA,'x').next()
|
x_elt = command_elt.elements(data_form.NS_X_DATA,'x').next()
|
||||||
answer_form = data_form.Form.fromElement(x_elt)
|
answer_form = data_form.Form.fromElement(x_elt)
|
||||||
command = answer_form['command']
|
command = answer_form['command']
|
||||||
except KeyError, StopIteration:
|
except (KeyError, StopIteration):
|
||||||
raise self.XEP_0050.AdHocError(self.XEP_0050.ERROR.BAD_PAYLOAD)
|
raise self.XEP_0050.AdHocError(self.XEP_0050.ERROR.BAD_PAYLOAD)
|
||||||
|
|
||||||
if command not in names_map:
|
if command not in names_map:
|
||||||
|
|
@ -192,7 +192,7 @@ class AdHocDBus(object):
|
||||||
path, iface, command = names_map[command]
|
path, iface, command = names_map[command]
|
||||||
proxy = self.session_bus.get_object(bus_name, path)
|
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
|
# job done, we can end the session, except if we have FLAG_LOOP
|
||||||
if FLAG_LOOP in flags:
|
if FLAG_LOOP in flags:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue