diff --git a/test.py b/test.py index 3808cbd..23671c2 100644 --- a/test.py +++ b/test.py @@ -12,7 +12,9 @@ attributes= ["title", fields = {} +@app.route("/r") def updateData(): + global data out = [] f = zipfile.ZipFile("library.tc") @@ -63,16 +65,19 @@ def updateData(): else: bookout[datum] = "" out.append(bookout.copy()) - return out.copy() + data = out.copy() + return "success" @app.route("/") def main(): - data = updateData(); + if data == []: + updateData() return render_template("main.html", books = data, attributes = attributes) @app.route("/book/") def book(id): - data = updateData(); + if data == []: + updateData() book = next((item for item in data if int(item["id"]) == id), {}) return render_template("book.html", book = book, fields = fields)