def put_map(): """ put a new map with name and description, the response would be the created new map metadata if failed, return 500 <TODO> later """ name = request.form.get("name") or "untitled" description = request.form.get("description") or "" info = {"NAME": name, "DESCRIPTION" : description} newmeta = data.createMap(info) content = json.dumps(newmeta) return Response(mimetype="application/json", status=200, response=content)
def put(self, _id): request_data = json.loads(self.request.body) name = request_data.get("name") or "untitled" description = request_data.get("description") or "" info = {"NAME": name, "DESCRIPTION" : description} newmeta = data.createMap(info) content = json.dumps(newmeta) self.set_status(200) self.set_header('Content-Type', 'application/json') self.write(content)