Merge pull request #161 from gazpachoking/update_flask

Update flask versions
This commit is contained in:
Matthew Scragg 2016-09-02 12:56:21 -04:00 committed by GitHub
commit a47d7e2471
14 changed files with 31 additions and 32 deletions

View file

@ -1,6 +1,6 @@
from realms import login_manager
from flask import request, flash, redirect
from flask.ext.login import login_url
from flask_login import login_url
modules = set()

View file

@ -1,5 +1,5 @@
from flask import render_template
from flask.ext.login import login_user
from flask_login import login_user
from realms import ldap
from flask_ldap_login import LDAPLoginForm
from ..models import BaseUser

View file

@ -1,5 +1,5 @@
from flask import current_app, render_template
from flask.ext.login import logout_user, login_user
from flask_login import logout_user, login_user
from realms import login_manager, db
from realms.lib.model import Model
from ..models import BaseUser

View file

@ -1,5 +1,5 @@
from flask import current_app
from flask.ext.login import UserMixin, logout_user, AnonymousUserMixin
from flask_login import UserMixin, logout_user, AnonymousUserMixin
from realms import login_manager
from realms.lib.util import gravatar_url
from itsdangerous import URLSafeSerializer, BadSignature

View file

@ -1,5 +1,5 @@
from flask import current_app, render_template, request, redirect, Blueprint, flash, url_for
from flask.ext.login import logout_user
from flask_login import logout_user
from realms.modules.auth.models import Auth
blueprint = Blueprint('auth', __name__, template_folder='templates')

View file

@ -14,7 +14,7 @@ def whoosh(app):
def elasticsearch(app):
from flask.ext.elastic import Elastic
from flask_elastic import Elastic
fields = app.config.get('ELASTICSEARCH_FIELDS')
return ElasticSearch(Elastic(app), fields)

View file

@ -2,7 +2,7 @@ import itertools
import sys
from datetime import datetime
from flask import abort, g, render_template, request, redirect, Blueprint, flash, url_for, current_app
from flask.ext.login import login_required, current_user
from flask_login import login_required, current_user
from realms.lib.util import to_canonical, remove_ext, gravatar_url
from .models import PageNotFound
@ -12,7 +12,7 @@ blueprint = Blueprint('wiki', __name__, template_folder='templates',
@blueprint.route("/_commit/<sha>/<path:name>")
def commit(name, sha):
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous():
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous:
return current_app.login_manager.unauthorized()
cname = to_canonical(name)
@ -27,7 +27,7 @@ def commit(name, sha):
@blueprint.route(r"/_compare/<path:name>/<regex('\w+'):fsha><regex('\.{2,3}'):dots><regex('\w+'):lsha>")
def compare(name, fsha, dots, lsha):
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous():
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous:
return current_app.login_manager.unauthorized()
diff = g.current_wiki.get_page(name, sha=lsha).compare(fsha)
@ -42,7 +42,7 @@ def revert():
commit = request.form.get('commit')
message = request.form.get('message', "Reverting %s" % cname)
if not current_app.config.get('ALLOW_ANON') and current_user.is_anonymous():
if not current_app.config.get('ALLOW_ANON') and current_user.is_anonymous:
return dict(error=True, message="Anonymous posting not allowed"), 403
if cname in current_app.config.get('WIKI_LOCKED_PAGES'):
@ -64,7 +64,7 @@ def revert():
@blueprint.route("/_history/<path:name>")
def history(name):
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous():
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous:
return current_app.login_manager.unauthorized()
return render_template('wiki/history.html', name=name)
@ -166,7 +166,7 @@ def _tree_index(items, path=""):
@blueprint.route("/_index", defaults={"path": ""})
@blueprint.route("/_index/<path:path>")
def index(path):
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous():
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous:
return current_app.login_manager.unauthorized()
items = g.current_wiki.get_index()
@ -187,7 +187,7 @@ def page_write(name):
if not cname:
return dict(error=True, message="Invalid name")
if not current_app.config.get('ALLOW_ANON') and current_user.is_anonymous():
if not current_app.config.get('ALLOW_ANON') and current_user.is_anonymous:
return dict(error=True, message="Anonymous posting not allowed"), 403
if request.method == 'POST':
@ -230,7 +230,7 @@ def page_write(name):
@blueprint.route("/", defaults={'name': 'home'})
@blueprint.route("/<path:name>")
def page(name):
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous():
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous:
return current_app.login_manager.unauthorized()
cname = to_canonical(name)