def _parse_iq(self, iq): cmd = getCommandElement(iq) form = data_form.findForm(cmd, formNamespace=collab.COLLAB_NS) if not form: raise ValueError('No Collab forms') return form.getValues()
def test_getCommandElement(self): iq = self.iq cmd = Command(node='test', action='execute') iq.addChild(cmd.toElement()) cmd2 = command.getCommandElement(iq) self.assertEquals(cmd2.toXml(), cmd.toElement().toXml())
def makeErr(e, iq): err = xmlstream.toResponse(iq) cmd = err.addChild(copyCommandElement(getCommandElement(iq))) cmd['status'] = 'complete' n = Note(e, 'error') cmd.addChild(n.toElement()) return err
def reset(e): self.pageManager.reset() self.stateManager.reset() err = xmlstream.toResponse(iq) cmd = err.addChild(copyCommandElement(getCommandElement(iq))) cmd['status'] = 'complete' n = Note(str(e), 'error') cmd.addChild(n.toElement()) return defer.succeed(err)
def can_process(self, iq): cmd = getCommandElement(iq) if not cmd: return False bs = [] bs.append(not cmd.hasAttribute('sessionid')) bs.append(cmd.compareAttribute('node', self.node)) return all(bs)
def test_getCommandElement(self): iq = self.iq cmd2 = command.getCommandElement(iq) self.assertTrue(cmd2 is None)
def makeExecutingCommand(iq, status="executing"): cmd = getCommandElement(iq) c = Command(node=cmd["node"], status=status) if cmd.hasAttribute("sessionid"): c.sessionid = cmd["sessionid"] return c
def can_process(self, iq): cmd = getCommandElement(iq) if not cmd: return False return cmd.compareAttribute('action', 'prev') and cmd.compareAttribute('node', self.node)