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
This commit is contained in:
parent
ed9df2984d
commit
a6897c76e0
1 changed files with 25 additions and 140 deletions
|
|
@ -23,7 +23,7 @@ from logging import debug, info, warning, error
|
|||
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 @@ class AdHocCommand(XMPPHandler):
|
|||
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 @@ class XEP_0050(object):
|
|||
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 @@ class XEP_0050(object):
|
|||
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue