diff --git a/cps/admin.py b/cps/admin.py index ad2db459..41273642 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -325,7 +325,7 @@ def configuration_helper(origin): 'credential': os.path.join(config.get_main_dir, 'gdrive_credentials')}) else: flash(_(u'client_secrets.json is not configured for web application'), category="error") - return render_title_template("config_edit.html", content=config, origin=origin, + return render_title_template("config_edit.html", config=config, origin=origin, gdriveError=gdriveError, gfeature_support=feature_support, title=_(u"Basic Configuration"), page="config") @@ -351,7 +351,7 @@ def configuration_helper(origin): else: ub.session.commit() flash(_(u'Keyfile location is not valid, please enter correct path'), category="error") - return render_title_template("config_edit.html", content=config, origin=origin, + return render_title_template("config_edit.html", config=config, origin=origin, gdriveError=gdriveError, feature_support=feature_support, title=_(u"Basic Configuration"), page="config") @@ -363,7 +363,7 @@ def configuration_helper(origin): else: ub.session.commit() flash(_(u'Certfile location is not valid, please enter correct path'), category="error") - return render_title_template("config_edit.html", content=config, origin=origin, + return render_title_template("config_edit.html", config=config, origin=origin, gdriveError=gdriveError, feature_support=feature_support, title=_(u"Basic Configuration"), page="config") content.config_uploading = 0 @@ -388,7 +388,7 @@ def configuration_helper(origin): if "config_ldap_provider_url" not in to_save or "config_ldap_dn" not in to_save: ub.session.commit() flash(_(u'Please enter a LDAP provider and a DN'), category="error") - return render_title_template("config_edit.html", content=config, origin=origin, + return render_title_template("config_edit.html", config=config, origin=origin, gdriveError=gdriveError, feature_support=feature_support, title=_(u"Basic Configuration"), page="config") else: @@ -446,7 +446,7 @@ def configuration_helper(origin): else: ub.session.commit() flash(_(u'Logfile location is not valid, please enter correct path'), category="error") - return render_title_template("config_edit.html", content=config, origin=origin, + return render_title_template("config_edit.html", config=config, origin=origin, gdriveError=gdriveError, feature_support=feature_support, title=_(u"Basic Configuration"), page="config") else: @@ -460,7 +460,7 @@ def configuration_helper(origin): content.config_rarfile_location = to_save["config_rarfile_location"].strip() else: flash(check[1], category="error") - return render_title_template("config_edit.html", content=config, origin=origin, + return render_title_template("config_edit.html", config=config, origin=origin, feature_support=feature_support, title=_(u"Basic Configuration")) try: if content.config_use_google_drive and is_gdrive_ready() and not \ @@ -477,14 +477,14 @@ def configuration_helper(origin): # logging.getLogger("uploader").setLevel(config.config_log_level) except Exception as e: flash(e, category="error") - return render_title_template("config_edit.html", content=config, origin=origin, + return render_title_template("config_edit.html", config=config, origin=origin, gdriveError=gdriveError, feature_support=feature_support, title=_(u"Basic Configuration"), page="config") if db_change: reload(db) if not db.setup_db(): flash(_(u'DB location is not valid, please enter correct path'), category="error") - return render_title_template("config_edit.html", content=config, origin=origin, + return render_title_template("config_edit.html", config=config, origin=origin, gdriveError=gdriveError, feature_support=feature_support, title=_(u"Basic Configuration"), page="config") if reboot_required: @@ -498,7 +498,7 @@ def configuration_helper(origin): gdrivefolders = listRootFolders() else: gdrivefolders = list() - return render_title_template("config_edit.html", origin=origin, success=success, content=config, + return render_title_template("config_edit.html", origin=origin, success=success, config=config, show_authenticate_google_drive=not is_gdrive_ready(), gdriveError=gdriveError, gdrivefolders=gdrivefolders, feature_support=feature_support, title=_(u"Basic Configuration"), page="config") diff --git a/cps/opds.py b/cps/opds.py index 8f718a0d..73cd790d 100644 --- a/cps/opds.py +++ b/cps/opds.py @@ -31,12 +31,13 @@ import ub from flask_login import current_user from functools import wraps from web import login_required_if_no_ano, fill_indexpage, common_filters, get_search_results, render_read_books -from sqlalchemy.sql.expression import func +from sqlalchemy.sql.expression import func, text import helper from werkzeug.security import check_password_hash from werkzeug.datastructures import Headers from web import download_required import sys + try: from urllib.parse import quote except ImportError: @@ -138,7 +139,7 @@ def feed_hot(): def feed_authorindex(): off = request.args.get("offset") or 0 entries = db.session.query(db.Authors).join(db.books_authors_link).join(db.Books).filter(common_filters())\ - .group_by('books_authors_link.author').order_by(db.Authors.sort).limit(config.config_books_per_page).offset(off) + .group_by(text('books_authors_link.author')).order_by(db.Authors.sort).limit(config.config_books_per_page).offset(off) pagination = Pagination((int(off) / (int(config.config_books_per_page)) + 1), config.config_books_per_page, len(db.session.query(db.Authors).all())) return render_xml_template('feed.xml', listelements=entries, folder='opds.feed_author', pagination=pagination) @@ -158,7 +159,7 @@ def feed_author(book_id): def feed_publisherindex(): off = request.args.get("offset") or 0 entries = db.session.query(db.Publishers).join(db.books_publishers_link).join(db.Books).filter(common_filters())\ - .group_by('books_publishers_link.publisher').order_by(db.Publishers.sort).limit(config.config_books_per_page).offset(off) + .group_by(text('books_publishers_link.publisher')).order_by(db.Publishers.sort).limit(config.config_books_per_page).offset(off) pagination = Pagination((int(off) / (int(config.config_books_per_page)) + 1), config.config_books_per_page, len(db.session.query(db.Publishers).all())) return render_xml_template('feed.xml', listelements=entries, folder='opds.feed_publisher', pagination=pagination) @@ -179,7 +180,7 @@ def feed_publisher(book_id): def feed_categoryindex(): off = request.args.get("offset") or 0 entries = db.session.query(db.Tags).join(db.books_tags_link).join(db.Books).filter(common_filters())\ - .group_by('books_tags_link.tag').order_by(db.Tags.name).offset(off).limit(config.config_books_per_page) + .group_by(text('books_tags_link.tag')).order_by(db.Tags.name).offset(off).limit(config.config_books_per_page) pagination = Pagination((int(off) / (int(config.config_books_per_page)) + 1), config.config_books_per_page, len(db.session.query(db.Tags).all())) return render_xml_template('feed.xml', listelements=entries, folder='opds.feed_category', pagination=pagination) @@ -199,7 +200,7 @@ def feed_category(book_id): def feed_seriesindex(): off = request.args.get("offset") or 0 entries = db.session.query(db.Series).join(db.books_series_link).join(db.Books).filter(common_filters())\ - .group_by('books_series_link.series').order_by(db.Series.sort).offset(off).all() + .group_by(text('books_series_link.series')).order_by(db.Series.sort).offset(off).all() pagination = Pagination((int(off) / (int(config.config_books_per_page)) + 1), config.config_books_per_page, len(db.session.query(db.Series).all())) return render_xml_template('feed.xml', listelements=entries, folder='opds.feed_series', pagination=pagination) diff --git a/cps/templates/config_edit.html b/cps/templates/config_edit.html index 19303cbe..8414032f 100644 --- a/cps/templates/config_edit.html +++ b/cps/templates/config_edit.html @@ -17,10 +17,10 @@