def delete(self, report_id, cell_pos, id):
     a = Area.get(Key(id))
     if a:
         a.delete()
         a = Response("deleted", mimetype='text/plain')
         a.status_code = 204
         return a
     abort(404)
 def delete(self, report_id, cell_pos, id):
     a = Area.get(Key(id))
     if a:
         a.delete();
         a = Response("deleted", mimetype='text/plain')
         a.status_code = 204;
         return a
     abort(404)
    def update(self, report_id, cell_pos, id):
        data = json.loads(request.data)
        a = Area.get(Key(id))

        a.geo = json.dumps(data['paths'])
        a.type = data['type']

        a.added_by = users.get_current_user()
        a.save()
        return Response(a.as_json(), mimetype='application/json')
    def update(self, report_id, cell_pos, id):
        data = json.loads(request.data)
        a = Area.get(Key(id))

        a.geo = json.dumps(data['paths'])
        a.type = data['type']

        a.added_by = users.get_current_user()
        a.save();
        return Response(a.as_json(), mimetype='application/json')
 def test_update(self):
     rv = self.app.put('/api/v0/report/' + str(self.r.key()) + '/cell/2_0_0/polygon/' + str(self.area.key()),
         data='{"paths": "[[1, 2, 3]]", "type": 100}'
     )
     self.assertEquals(1, Area.all().count())
     a = Area.get(self.area.key())
     self.assertEquals(100, a.type)
     self.assertEquals("\"[[1, 2, 3]]\"", a.geo)
     js = json.loads(rv.data)
     self.assertEquals(100, js['type'])
     self.assertEquals("[[1, 2, 3]]", js['paths'])
Example #6
0
 def test_update(self):
     rv = self.app.put('/api/v0/report/' + str(self.r.key()) +
                       '/cell/2_0_0/polygon/' + str(self.area.key()),
                       data='{"paths": "[[1, 2, 3]]", "type": 100}')
     self.assertEquals(1, Area.all().count())
     a = Area.get(self.area.key())
     self.assertEquals(100, a.type)
     self.assertEquals("\"[[1, 2, 3]]\"", a.geo)
     js = json.loads(rv.data)
     self.assertEquals(100, js['type'])
     self.assertEquals("[[1, 2, 3]]", js['paths'])
 def get(self, report_id, cell_pos, id):
     a = Area.get(Key(id))
     if not a:
         abort(404)
     return Response(a.as_json(), mimetype='application/json')
 def get(self, report_id, cell_pos, id):
     a = Area.get(Key(id))
     if not a:
         abort(404)
     return Response(a.as_json(), mimetype='application/json')