def new_country(book_uuid, country): ds = DataStorage() if ds.add_country(book_uuid, country): ds.save() else: print("Failed") return country
def delete_recipe(uuid): ds = DataStorage() res = ds.delete_recipe(uuid) ds.save() return uuid
def save_recipe(): ds = DataStorage() new = ds.update(json.loads(request.json)) ds.save() return jsonify({"was_new": new, "recipe": request.json})
def get_recipe(uuid): ds = DataStorage() r, country = ds.find_recipe(uuid) r["country"] = country["country"] return json.dumps(r)
def index(): ds = DataStorage() all = ds.get_all() print(all) return render_template("index.html", title="title", all=all)