Skip to content
This repository was archived by the owner on Nov 28, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mhvdb2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion mhvdb2/admin/authentication.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
8 changes: 4 additions & 4 deletions mhvdb2/admin/routes.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion mhvdb2/templates/_layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
{% endfor %}
</ul>
<p class="navbar-text navbar-right">
{% if current_user.is_authenticated() %}
{% if current_user.is_authenticated %}
Signed in as {{current_user.name}} – <a href="{{ url_for('admin.logout') }}">Log out</a>
{% endif %}
</p>
Expand Down
29 changes: 17 additions & 12 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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