From b38e4fa0bb17b7e9545b286b64b9bfb25dc1390e Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Wed, 2 Feb 2022 18:49:55 +1100 Subject: [PATCH] if we do confuse the viewing / states AND we are in prod, then delete states and tell user to get a new tab / try again -- lame but it will work as a catch all --- files.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/files.py b/files.py index 58e3fce..3ec19cb 100644 --- a/files.py +++ b/files.py @@ -729,7 +729,12 @@ def view(id): # face locn data, just warn & redirect if id not in eids: print( f"ERROR: viewing an id, but its not in eids OPT={OPT}, id={id}, eids={eids}") - st.SetMessage("Sorry, viewing data is confused, cannot view this image now", "warning" ) + msg="Sorry, viewing data is confused, cannot view this image now" + if os.environ['FLASK_ENV'] == "production": + msg += "Clearing out all states. This means browser back buttons will not work, please start a new tab and try again" + PA_UserState.query.delete() + db.session.commit() + st.SetMessage( msg, "warning" ) return redirect("/") else: return render_template("viewer.html", current=int(id), eids=eids, objs=objs, OPT=OPT )