From 2eb4f77a239fe7a209cce3b2201a64dad4d47c5c Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 26 Oct 2024 15:34:57 +0200 Subject: [PATCH] Display error message if visiblity resticting custom column is no available (Fix for #3190) --- cps/admin.py | 20 +++++++++++++++++--- cps/static/css/caliBlur.css | 7 +++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/cps/admin.py b/cps/admin.py index f7a7bee2..bc767a89 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -306,7 +306,15 @@ def edit_user_table(): .group_by(text('books_tags_link.tag')) \ .order_by(db.Tags.name).all() if config.config_restricted_column: - custom_values = calibre_db.session.query(db.cc_classes[config.config_restricted_column]).all() + try: + custom_values = calibre_db.session.query(db.cc_classes[config.config_restricted_column]).all() + except (KeyError, AttributeError, IndexError): + custom_values = [] + log.error("Custom Column No.{} does not exist in calibre database".format( + config.config_restricted_column)) + flash(_("Custom Column No.%(column)d does not exist in calibre database", + column=config.config_restricted_column), + category="error") else: custom_values = [] if not config.config_anonbrowse: @@ -982,8 +990,14 @@ def prepare_tags(user, action, tags_name, id_list): raise Exception(_("Tag not found")) new_tags_list = [x.name for x in tags] else: - tags = calibre_db.session.query(db.cc_classes[config.config_restricted_column]) \ - .filter(db.cc_classes[config.config_restricted_column].id.in_(id_list)).all() + try: + tags = calibre_db.session.query(db.cc_classes[config.config_restricted_column]) \ + .filter(db.cc_classes[config.config_restricted_column].id.in_(id_list)).all() + except (KeyError, AttributeError, IndexError): + log.error("Custom Column No.{} does not exist in calibre database".format( + config.config_restricted_column)) + raise Exception(_("Custom Column No.%(column)d does not exist in calibre database", + column=config.config_restricted_column)) new_tags_list = [x.value for x in tags] saved_tags_list = user.__dict__[tags_name].split(",") if len(user.__dict__[tags_name]) else [] if action == "remove": diff --git a/cps/static/css/caliBlur.css b/cps/static/css/caliBlur.css index 3647b871..dc42396a 100644 --- a/cps/static/css/caliBlur.css +++ b/cps/static/css/caliBlur.css @@ -3268,6 +3268,10 @@ div.btn-group[role=group][aria-label="Download, send to Kindle, reading"] > div. left: auto !important } +ul.dropdown-menu.offscreen { + margin: 2px -160px 0 +} + div.btn-group[role=group][aria-label="Download, send to Kindle, reading"] .dropdown-menu.offscreen { position: fixed; top: 120px; @@ -4333,6 +4337,7 @@ body.advanced_search > div.container-fluid > div.row-fluid > div.col-sm-10 > div .navbar-right > li > ul.dropdown-menu.offscreen { right: -10px + } .login .plexBack, body.login > div.container-fluid > div.row-fluid > div.col-sm-2, body.login > div.navbar.navbar-default.navbar-static-top > div > form { @@ -7951,3 +7956,5 @@ div.comments[data-readmore] { transition: height 300ms; overflow: hidden } + +.dropdown-menu > .offscreen