Example #1
0
    def get(self):
        if ('id' not in self.request.arguments):
            resp = {}
            resp['ret'] = retcode.MISS_ARGUMENT
            resp['ret_msg'] = retcode.get_ret_msg(resp['ret'])
            jsonstr = json.dumps(resp)
            self.set_header('Content-Type', 'application/json')
            self.write(jsonstr)
            return

        id = int(self.get_argument('id'))

        if (id < 0):
            resp = {}
            resp['ret'] = retcode.INVALID_ARGUMENT_VALUE
            resp['ret_msg'] = retcode.get_ret_msg(resp['ret'])
            jsonstr = json.dumps(resp)
            self.set_header('Content-Type', 'application/json')
            self.write(jsonstr)
            return

        ret, data = admin_logic.view_user(id)
        
        resp = {}
        resp['ret'] = ret
        resp['ret_msg'] = retcode.get_ret_msg(resp['ret'])
        resp['data'] = data 
        jsonstr = json.dumps(resp)
        self.set_header('Content-Type', 'application/json')
        self.write(jsonstr)
Example #2
0
 def get(self):
     self.set_secure_cookie('user', 'xxxxxxxx')
     resp = {}
     resp['ret'] = retcode.OK
     resp['ret_msg'] = retcode.get_ret_msg(resp['ret'])
     jsonstr = json.dumps(resp)
     self.set_header('Content-Type', 'application/json')
     self.write(jsonstr)