Пример #1
0
    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()
Пример #2
0
    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())
Пример #3
0
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
Пример #4
0
 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)
Пример #5
0
    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)
Пример #6
0
 def test_getCommandElement(self):
     iq = self.iq
     cmd2 = command.getCommandElement(iq)
     self.assertTrue(cmd2 is None)
Пример #7
0
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
Пример #8
0
    def can_process(self, iq):
        cmd = getCommandElement(iq)
        if not cmd:
            return False

        return cmd.compareAttribute('action', 'prev') and cmd.compareAttribute('node', self.node)