diff src/plugins/plugin_xep_0050.py @ 941:c6d8fc63b1db

core, plugins: host.getClient now raise an exception instead of returning None when no profile is found, plugins have been adapted consequently and a bit cleaned
author Goffi <goffi@goffi.org>
date Fri, 28 Mar 2014 18:07:02 +0100
parents 1a759096ccbd
children e1842ebcb2f3
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0050.py	Fri Mar 28 18:06:51 2014 +0100
+++ b/src/plugins/plugin_xep_0050.py	Fri Mar 28 18:07:02 2014 +0100
@@ -23,7 +23,7 @@
 from twisted.words.protocols.jabber import jid
 from twisted.words.protocols.jabber import error as xmpp_error
 from twisted.words.xish import domish
-from twisted.internet import defer, reactor
+from twisted.internet import defer
 from wokkel import disco, iwokkel, data_form, compat
 from sat.core import exceptions
 from sat.memory.memory import Sessions
@@ -112,7 +112,7 @@
         return False
 
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
-        identities = [ID_CMD_LIST if self.node == NS_COMMANDS else ID_CMD_NODE]
+        # identities = [ID_CMD_LIST if self.node == NS_COMMANDS else ID_CMD_NODE] # FIXME
         return [disco.DiscoFeature(NS_COMMANDS)] + self.features
 
     def getDiscoItems(self, requestor, target, nodeIdentifier=''):
@@ -303,8 +303,6 @@
                 node = session_data['node'] = data[xml_tools.SAT_FORM_PREFIX+'node']
 
             client = self.host.getClient(profile)
-            if not client:
-                raise exceptions.ProfileUnknownError
 
             # we request execute node's command
             iq_elt = compat.IQ(client.xmlstream, 'set')
@@ -360,7 +358,7 @@
                 x_elt = command_elt.elements(data_form.NS_X_DATA,'x').next()
                 answer_form = data_form.Form.fromElement(x_elt)
                 show = answer_form['show']
-            except KeyError, StopIteration:
+            except (KeyError, StopIteration):
                 raise AdHocError(XEP_0050.ERROR.BAD_PAYLOAD)
             if show not in SHOWS:
                 raise AdHocError(XEP_0050.ERROR.BAD_PAYLOAD)