Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Changed error message in case of trying to delete a shelf unauthorized
Removed outcommented text
  • Loading branch information
OzzieIsaacs committed Nov 20, 2021
1 parent d624b67 commit 6f5390e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
9 changes: 0 additions & 9 deletions cps/db.py
Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions cps/shelf.py
Expand Up @@ -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]:
Expand Down Expand Up @@ -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"])
Expand Down

0 comments on commit 6f5390e

Please sign in to comment.