def post(self): data = get_data_from_request(request) test = validate_server(data) if test is not True: return abort(400, message=test) data = clean_request_data(data) server = serverClient.insert(data) result = serverClient.find(key="_id", value=str(server)) result = sanitize_data(result[0]) return result
def put(self,resID): result = serverClient.find(key="_id", value=resID) data = get_data_from_request(request) test = validate_server(data) if test is not True: return abort(400, message=test) else: for key, value in data.iteritems(): if key in ("_id", "created", "updated"): pass else: result[0][key] = value cleanRes = clean_request_data(result[0]) obj = serverClient.update(cleanRes) obj = clean_response_data(obj) return obj