def POST(self, format): data = get_data(name="mapfile", mandatory=["name"], authorized=["name", "title", "abstract"]) map_name = data.pop("name") path = tools.mk_mapfile_path(map_name) with webapp.mightConflict(message="Mapfile '{exception}' already exists."): mapfile.create_mapfile(path, map_name, data) webapp.Created("%s/maps/%s%s" % (web.ctx.home, map_name, (".%s" % format) if format else ""))
def PUT(self, map_name, format): mf = get_mapfile(map_name) path = tools.mk_mapfile_path(map_name) data = get_data(name="mapfile", mandatory=["name"], authorized=["name", "title", "abstract"]) if map_name != data.pop("name"): raise webapp.Forbidden("Can't change the name of a mapfile.") mf.update(data) mf.save()