def post(self): try: name = self.request.POST["name"] x_long = self.request.POST["x_long"] y_lat = self.request.POST["y_lat"] category = self.request.POST["category"] except KeyError as e: self.response.status = 404 return map_marker = MapMarker(name=name, location=db.GeoPt(y_lat, x_long), category=category) if self.request.POST["url"]: map_marker.url = self.request.POST["url"] if self.request.POST["summary"]: map_marker.summary = self.request.POST["symmary"] if self.request.POST["address"]: map_marker.uaddress = self.request.POST["address"] if self.request.POST["img_url"]: map_marker.img_url = self.request.POST["img_url"] map_marker.update_location() map_marker.put() self.response.status = 201
def get(self): lat = self.request.GET.get('lat', (-90 + random() * 180)) lon = self.request.GET.get('lon', (-180 + random() * 360)) map_marker = MapMarker(name="test", location=db.GeoPt(lat, lon)) map_marker.put() self.response.write("Enregistre : %s" % str(map_marker.location))