From 6a76dce87092b62f97d37d361dc48e941e7bb7b0 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 28 Jul 2018 17:19:08 +0200 Subject: [PATCH] Fix change user (in case of reboot required) Fix no existing database Update required version for sqlalchemy --- cps/db.py | 4 +++- cps/web.py | 1 + requirements.txt | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cps/db.py b/cps/db.py index 779183b0..877dc8b9 100755 --- a/cps/db.py +++ b/cps/db.py @@ -318,8 +318,10 @@ def setup_db(): return False dbpath = os.path.join(config.config_calibre_dir, "metadata.db") - engine = create_engine('sqlite:///' + dbpath, echo=False, isolation_level="SERIALIZABLE") try: + if not os.path.exists(dbpath): + raise + engine = create_engine('sqlite:///' + dbpath, echo=False, isolation_level="SERIALIZABLE") conn = engine.connect() except Exception: content = ub.session.query(ub.Settings).first() diff --git a/cps/web.py b/cps/web.py index 39d56ae3..6598064b 100755 --- a/cps/web.py +++ b/cps/web.py @@ -2491,6 +2491,7 @@ def configuration(): @login_required @admin_required def view_configuration(): + reboot_required = False if request.method == "POST": to_save = request.form.to_dict() content = ub.session.query(ub.Settings).first() diff --git a/requirements.txt b/requirements.txt index a5f80c0f..3fb23ea3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ iso-639>=0.4.5 PyPDF2==1.26.0 pytz>=2016.10 requests>=2.11.1 -SQLAlchemy>=0.8.4 +SQLAlchemy>=1.1.0 tornado>=4.1 Wand>=0.4.4 unidecode>=0.04.19