From 6f5390ead5df9779ac81fadefffb476e03f93548 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 20 Nov 2021 12:17:03 +0100 Subject: [PATCH] Changed error message in case of trying to delete a shelf unauthorized Removed outcommented text --- cps/db.py | 9 --------- cps/shelf.py | 8 ++++---- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/cps/db.py b/cps/db.py index 06a42b8ec..800fb3dd1 100644 --- a/cps/db.py +++ b/cps/db.py @@ -807,15 +807,6 @@ def speaking_language(self, languages=None): .group_by(text('books_languages_link.lang_code')).all() for lang in languages: lang.name = isoLanguages.get_language_name(get_locale(), lang.lang_code) - #try: - # if lang.lang_code.lower() == "und": - # lang.name = isoLanguages.get_language_name(get_locale(), lang.lang_code) - # # lang.name = _("Undetermined") - # else: - # cur_l = LC.parse(lang.lang_code) - # lang.name = cur_l.get_language_name(get_locale()) - #except UnknownLocaleError: - # lang.name = _(isoLanguages.get(part3=lang.lang_code).name) return languages def update_title_sort(self, config, conn=None): diff --git a/cps/shelf.py b/cps/shelf.py index 09fe8dd4e..2c6a17a2d 100644 --- a/cps/shelf.py +++ b/cps/shelf.py @@ -122,8 +122,8 @@ def search_to_shelf(shelf_id): return redirect(url_for('web.index')) if not check_shelf_edit_permissions(shelf): - log.warning("You are not allowed to add a book to the the shelf: {}".format(shelf.name)) - flash(_(u"You are not allowed to add a book to the the shelf: %(name)s", name=shelf.name), category="error") + log.warning("You are not allowed to add a book to the shelf".format(shelf.name)) + flash(_(u"You are not allowed to add a book to the shelf"), category="error") return redirect(url_for('web.index')) if current_user.id in ub.searched_ids and ub.searched_ids[current_user.id]: @@ -215,10 +215,10 @@ def remove_from_shelf(shelf_id, book_id): else: if not xhr: log.warning("You are not allowed to remove a book from shelf: {}".format(shelf.name)) - flash(_(u"Sorry you are not allowed to remove a book from this shelf: %(sname)s", sname=shelf.name), + flash(_(u"Sorry you are not allowed to remove a book from this shelf"), category="error") return redirect(url_for('web.index')) - return "Sorry you are not allowed to remove a book from this shelf: %s" % shelf.name, 403 + return "Sorry you are not allowed to remove a book from this shelf", 403 @shelf.route("/shelf/create", methods=["GET", "POST"])