Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 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