def post(self): username = self.get_current_user() customer_name = ( get_user_property(username, UserKeys.CurrentCustomer) ) uri = self.request.uri method = self.request.method try: mouse_name = self.arguments.get('name') address = self.arguments.get('address') customers = self.arguments.get('customers', None) mm = MightyMouse(username, customer_name, uri, method) results = mm.add(mouse_name, address, customers) self.set_status(results['http_status']) self.set_header('Content-Type', 'application/json') self.write(json.dumps(results, indent=4)) except Exception as e: results = ( GenericResults( username, uri, method ).something_broke(agent_id, '', e) ) logger.exception(e) self.set_status(results['http_status']) self.set_header('Content-Type', 'application/json') self.write(json.dumps(results, indent=4))
def post(self): username = self.get_current_user() customer_name = (get_user_property(username, UserKeys.CurrentCustomer)) uri = self.request.uri method = self.request.method try: mouse_name = self.arguments.get('name') address = self.arguments.get('address') customers = self.arguments.get('customers', None) mm = MightyMouse(username, customer_name, uri, method) results = mm.add(mouse_name, address, customers) self.set_status(results['http_status']) self.set_header('Content-Type', 'application/json') self.write(json.dumps(results, indent=4)) except Exception as e: results = (GenericResults(username, uri, method).something_broke(agent_id, '', e)) logger.exception(e) self.set_status(results['http_status']) self.set_header('Content-Type', 'application/json') self.write(json.dumps(results, indent=4))