def get_one(self, id): parser = RequestParser() # Look only in the querystring parser.add_argument('user', location='args', default=None) args = parser.parse_args(request) dao = TimerDAO() timer = dao.get(id) as_dict = TimerFormatter().model_to_dict(timer) resp = jsonify(as_dict) return resp
def put(self, id): #api_v1_root = '/api/v1' timer_new = TimerFormatter().dict_to_model(TimerEntity, request.json) dao = TimerDAO() timer = dao.get(id) if timer is not None: timer.update_attributes(timer_new) dao.put(timer) id = str(timer.id) resp = jsonify(dict(id=id)) #resp.headers["Location"] = api_v1_root + self.root + "/" + id resp.headers["Location"] = self.make_location(request.url, id) resp.status_code = http.client.OK return resp