diff --git a/mhvdb2/__init__.py b/mhvdb2/__init__.py index df269a5..83106d8 100644 --- a/mhvdb2/__init__.py +++ b/mhvdb2/__init__.py @@ -6,7 +6,7 @@ app.config.from_object('settings') -database = SqliteDatabase(app.config['DATABASE'], threadlocals=True) +database = SqliteDatabase(app.config['DATABASE']) from mhvdb2.admin import admin # noqa app.register_blueprint(admin, url_prefix='/admin') diff --git a/mhvdb2/admin/authentication.py b/mhvdb2/admin/authentication.py index a516295..f10069c 100644 --- a/mhvdb2/admin/authentication.py +++ b/mhvdb2/admin/authentication.py @@ -1,4 +1,4 @@ -from flask.ext.login import LoginManager, UserMixin, login_user +from flask_login import LoginManager, UserMixin, login_user from mhvdb2.models import User as UserModel from werkzeug.security import generate_password_hash, check_password_hash diff --git a/mhvdb2/admin/routes.py b/mhvdb2/admin/routes.py index 97894b3..a90ba8a 100644 --- a/mhvdb2/admin/routes.py +++ b/mhvdb2/admin/routes.py @@ -1,7 +1,7 @@ from mhvdb2.models import Entity, User -from flask import render_template, request, flash, redirect, url_for +from flask import render_template, request, flash, redirect, url_for, current_app from .authentication import authenticate_user, register_user -from flask.ext.login import login_required, current_user, logout_user, current_app +from flask_login import login_required, current_user, logout_user from datetime import datetime, date from . import admin from mhvdb2 import resources, app, mailer @@ -46,7 +46,7 @@ def login_post(): @admin.route("/register", methods=["GET"]) def register(): # Only allow access if logged in or no users are registered - if current_user.is_anonymous() and User.select().count() > 0: + if current_user.is_anonymous and User.select().count() > 0: return current_app.login_manager.unauthorized() return render_template("admin/register.html") @@ -55,7 +55,7 @@ def register(): @admin.route("/register", methods=["POST"]) def register_post(): # Only allow access if logged in or no users are registered - if current_user.is_anonymous() and User.select().count() > 0: + if current_user.is_anonymous and User.select().count() > 0: return current_app.login_manager.unauthorized() name = get_post_value("name") diff --git a/mhvdb2/templates/_layout.html b/mhvdb2/templates/_layout.html index 3beaa2d..636d3e9 100644 --- a/mhvdb2/templates/_layout.html +++ b/mhvdb2/templates/_layout.html @@ -51,7 +51,7 @@ {% endfor %} diff --git a/requirements.txt b/requirements.txt index a3aaf66..b683251 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,17 @@ -Flask==1.0 -Flask-Login==0.2.11 -Jinja2==2.7.3 -MarkupSafe==0.23 -Werkzeug==0.15.3 -freezegun==0.2.8 -gunicorn==19.5.0 -itsdangerous==0.24 -peewee==2.4.7 -python-dateutil==2.4.0 -requests==2.20.0 -six==1.9.0 +certifi==2019.9.11 +chardet==3.0.4 +Click==7.0 +Flask==1.1.1 +Flask-Login==0.4.1 +freezegun==0.3.12 +gunicorn==20.0.0 +idna==2.7 +itsdangerous==1.1.0 +Jinja2==2.10.3 +MarkupSafe==1.1.1 +peewee==3.11.2 +python-dateutil==2.8.1 +requests==2.22.0 +six==1.13.0 +urllib3==1.25.6 +Werkzeug==0.16.0