From cdcb8a50d130a5cc61fc4ca52b0f1f029400cce3 Mon Sep 17 00:00:00 2001 From: Michael Shavit Date: Sun, 22 Dec 2019 12:40:31 -0500 Subject: [PATCH] Fix /reconnect endpoint, which was broken by https://github.com/janeczku/calibre-web/commit/006e596c7221729c9a37b79037fa72bb88506492 --- cps/db.py | 3 ++- cps/web.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cps/db.py b/cps/db.py index 5765bf68..d4b4a7ed 100755 --- a/cps/db.py +++ b/cps/db.py @@ -33,7 +33,7 @@ from sqlalchemy.ext.declarative import declarative_base session = None cc_exceptions = ['datetime', 'comments', 'float', 'composite', 'series'] cc_classes = {} - +engine = None Base = declarative_base() @@ -327,6 +327,7 @@ def update_title_sort(config, conn=None): def setup_db(config): dispose() + global engine if not config.config_calibre_dir: config.invalidate() diff --git a/cps/web.py b/cps/web.py index 7aa921e4..019887c7 100644 --- a/cps/web.py +++ b/cps/web.py @@ -44,7 +44,7 @@ from werkzeug.exceptions import default_exceptions from werkzeug.datastructures import Headers from werkzeug.security import generate_password_hash, check_password_hash -from . import constants, logger, isoLanguages, services, worker +from . import constants, config, logger, isoLanguages, services, worker from . import searched_ids, lm, babel, db, ub, config, get_locale, app from .gdriveutils import getFileFromEbooksFolder, do_gdrive_download from .helper import common_filters, get_search_results, fill_indexpage, speaking_language, check_valid_domain, \ @@ -786,7 +786,7 @@ def get_tasks_status(): def reconnect(): db.session.close() db.engine.dispose() - db.setup_db() + db.setup_db(config) return json.dumps({}) @web.route("/search", methods=["GET"])