Fix usage of is_anonymous as a method for new version of flask-login

This commit is contained in:
Chase Sterling 2016-09-06 00:08:58 -04:00
parent c6016c6116
commit 07b5371a1a
2 changed files with 3 additions and 3 deletions

View file

@ -11,7 +11,7 @@ blueprint = Blueprint('search', __name__, template_folder='templates')
@blueprint.route('/_search') @blueprint.route('/_search')
def search(): def search():
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 current_app.login_manager.unauthorized()
results = search_engine.wiki(request.args.get('q')) results = search_engine.wiki(request.args.get('q'))

View file

@ -80,7 +80,7 @@ def history(name):
@blueprint.route("/_history_data/<path:name>") @blueprint.route("/_history_data/<path:name>")
def history_data(name): def history_data(name):
"""Ajax provider for paginated history data.""" """Ajax provider for paginated history data."""
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 current_app.login_manager.unauthorized()
draw = int(request.args.get('draw', 0)) draw = int(request.args.get('draw', 0))
start = int(request.args.get('start', 0)) start = int(request.args.get('start', 0))
@ -145,7 +145,7 @@ def _partials(imports, sha='HEAD'):
@blueprint.route("/_partials") @blueprint.route("/_partials")
def partials(): def partials():
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 current_app.login_manager.unauthorized()
return {'partials': _partials(request.args.getlist('imports[]'))} return {'partials': _partials(request.args.getlist('imports[]'))}