From e806494b5411d181ef33b459e30759e459871265 Mon Sep 17 00:00:00 2001 From: Jonathan Rehm Date: Mon, 11 Sep 2017 09:22:36 -0700 Subject: [PATCH] Ensure variables exist before they're used --- cps/web.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cps/web.py b/cps/web.py index 1437743b..15f58057 100755 --- a/cps/web.py +++ b/cps/web.py @@ -1204,13 +1204,12 @@ def language_overview(): lang.name = _(isoLanguages.get(part3=lang.lang_code).name) else: try: - langfound = 1 cur_l = LC.parse(current_user.filter_language()) except Exception: - langfound = 0 + cur_l = None languages = db.session.query(db.Languages).filter( db.Languages.lang_code == current_user.filter_language()).all() - if langfound: + if cur_l: languages[0].name = cur_l.get_language_name(get_locale()) else: languages[0].name = _(isoLanguages.get(part3=languages[0].lang_code).name) @@ -2146,6 +2145,7 @@ def edit_shelf(shelf_id): @login_required def delete_shelf(shelf_id): cur_shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.id == shelf_id).first() + deleted = false if current_user.role_admin(): deleted = ub.session.query(ub.Shelf).filter(ub.Shelf.id == shelf_id).delete() else: