def put(self, fname, process): if process == "alter": ret = cu.fn_config(fname, 'save', self.request.body) self.set_header('Content-Type', 'application/json') jret = json.dumps(ret) self.set_header("Cache-control", "no-cache") self.write(jret)
def get(self, fname, process): if process == "get_cfg": data = cu.fn_config(fname, 'get_cfg') self.set_header('Content-Type', 'application/json') ret = {'result':'ok', 'info':data} jret = json.dumps(ret) self.set_header("Cache-control", "no-cache") self.write(jret) elif process == "restart": ret = {} ret['result'] = 'ok' ret['info'] = 'exit!!!' global rh rh.join() global _ioloop _ioloop.stop() self.write(ret) python = sys.executable os.execl(python, python, * sys.argv) elif process == "getValuesByKeys": ret = {} data = cu.fn_config(fname, 'get_kvs', self.request.arguments) ret['result'] = 'ok' ret['info'] = data self.set_header('Content-Type', 'application/json') jret = json.dumps(ret) self.set_header("Cache-control", "no-cache") self.write(jret) elif process == "setValuesByKeys": ret = cu.fn_config(fname, 'alter', self.request.arguments) jret = json.dumps(ret) self.set_header('Content-Type', 'application/json') self.set_header('Cache-control', 'no-cache') self.write(jret)