本文整理匯總了Python中application.models.Area.get方法的典型用法代碼示例。如果您正苦於以下問題:Python Area.get方法的具體用法?Python Area.get怎麽用?Python Area.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類application.models.Area
的用法示例。
在下文中一共展示了Area.get方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: delete
# 需要導入模塊: from application.models import Area [as 別名]
# 或者: from application.models.Area import get [as 別名]
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)
示例2: update
# 需要導入模塊: from application.models import Area [as 別名]
# 或者: from application.models.Area import get [as 別名]
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')
示例3: test_update
# 需要導入模塊: from application.models import Area [as 別名]
# 或者: from application.models.Area import get [as 別名]
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'])
示例4: get
# 需要導入模塊: from application.models import Area [as 別名]
# 或者: from application.models.Area import get [as 別名]
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')