def POST(self): if not cache_valid(self.cache_time): web.http.expires(timedelta(days=1)) request = web.input() business, request_type = Business.get_business(request) print business if request_type == '3' or request_type == '4': return render.main2(json.dumps(business)) else: return render.main(json.dumps(business))
def POST(self, *args): if not cache_valid(self.cache_time): web.http.expires(timedelta(days=1)) request_data = eval(web.data())['request'] request_type = utils.s(request_data['type']) response = utils.generate_response_header(request_data) if request_type == 'get_all_service': try: services = model_ora.get_service() result = [] for item in services: tmp = { 'service_name': item } result.append(tmp) response.update({ 'data': result, 'result': 'success' }) except Exception, e: response.update({ 'message': e.message, 'result': 'fail' }) return json.dumps(response) elif request_type == 'get_ip_service': ip_address = request_data['ip_address'] services = model_ora.get_ip_accord_business(ip_address) response.update({ 'data': services, 'result': 'success', 'ip_address': ip_address }) return render.main(response)