From 13666206dc6007537ef2cfc7f599e76434a4c7f1 Mon Sep 17 00:00:00 2001 From: jwansek Date: Sat, 6 Dec 2025 19:57:54 +0000 Subject: Temporarily removed the 'random' feature since it needs to be fixed --- edaweb/app.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'edaweb/app.py') diff --git a/edaweb/app.py b/edaweb/app.py index 436df7a..36fe8bb 100644 --- a/edaweb/app.py +++ b/edaweb/app.py @@ -214,26 +214,26 @@ def get_iso_cd(): id_ = id_ ) -@app.route("/random") -def serve_random(): - try: - tags = flask.request.args['tags'].split(" ") - except KeyError: - flask.abort(400) - - sbi = services.get_random_image(tags) - req = urllib.request.Request(sbi.imurl) - mediaContent = urllib.request.urlopen(req).read() - with open(os.path.join(os.path.dirname(__file__), "static", "images", "random.jpg"), "wb") as f: - f.write(mediaContent) - - with database.Database() as db: - return flask.render_template( - "random.html.j2", - **get_template_items("random image", db), - sbi = sbi, - localimg = "/img/random.jpg?seed=%i" % random.randint(0, 9999) - ) +#@app.route("/random") +#def serve_random(): +# try: +# tags = flask.request.args['tags'].split(" ") +# except KeyError: +# flask.abort(400) +# +# sbi = services.get_random_image(tags) +# req = urllib.request.Request(sbi.imurl) +# mediaContent = urllib.request.urlopen(req).read() +# with open(os.path.join(os.path.dirname(__file__), "static", "images", "random.jpg"), "wb") as f: +# f.write(mediaContent) +# +# with database.Database() as db: +# return flask.render_template( +# "random.html.j2", +# **get_template_items("random image", db), +# sbi = sbi, +# localimg = "/img/random.jpg?seed=%i" % random.randint(0, 9999) +# ) @app.route("/questions") def serve_questions(): -- cgit v1.2.3