def post(self, _id): info = {} request_data = json.loads(self.request.body) info['NAME'] = request_data.get('name') info['DESCRIPTION'] = request_data.get('description') data.modifyMap(request.form.get('id'), info) content = json.dumps(data.getMaps()) self.set_status(200) self.set_header('Content-Type', 'application/json') self.write(content)
def change_map(): ''' this is the post api for modifying map it could modify the name and the description _id is a must field and 'name'/'description' are optional ''' info = {} info['NAME'] = request.form.get('name') info['DESCRIPTION'] = request.form.get('description') data.modifyMap(request.form.get('id'), info) content = json.dumps(data.getMaps()) return Response(mimetype="application/json", status=200, response=content)