def write_json(self, data,status_code=200, msg='success.'): jsonUtil = JsonUtil() self.finish( jsonUtil.parseJsonObj( { 'error_info':data, 'error_code': status_code, 'error_reason': msg, } ))
def write_httperror(self,data,**kwargs): jsonUtil = JsonUtil() self.finish( jsonUtil.parseJsonObj( { 'error_info':data, 'error_code': kwargs['status_code'], 'error_reason': kwargs['reason'], } ))
def write_json_byobj(self, data): jsonUtil = JsonUtil() retstr = jsonUtil.parseJsonObj(data) self.finish(retstr)