Ejemplo n.º 1
0
    def performAction(self, request):
        # get parameters
        action = request.args['action'][0]
        message = request.args['message'][0]
        users = []
        if request.args.has_key('username'):
            users.append(request.args['username'][0])

        # perform action based on action parameter
        if action == 'push':
            child = GlobalObject().root.childsmanager.getChildByName('gate')
            if child:
                msg = { KEY_ERRNO : E_OK, KEY_DATA : { KEY_MESSAGE : message } }
                child.callbackChild('pushObject', COMMAND_TEST_PUSH, json.dumps(msg), users)
Ejemplo n.º 2
0
 def user(self, request, tag):
     gate = GlobalObject().root.childsmanager.getChildByName('gate')
     d = gate.callbackChild('getUserNames')
     d.addCallback(self.onUserNamesCollected, tag)
     yield d