flask 0.11 compatibility
This commit is contained in:
parent
328f41b85c
commit
9ac015b3dd
5 changed files with 13 additions and 13 deletions
|
@ -18,7 +18,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)
|
||||
|
@ -35,7 +35,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)
|
||||
|
@ -50,7 +50,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'):
|
||||
|
@ -72,7 +72,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)
|
||||
|
||||
|
@ -80,7 +80,7 @@ def history(name):
|
|||
@blueprint.route("/_history_data/<path:name>")
|
||||
def history_data(name):
|
||||
"""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()
|
||||
draw = int(request.args.get('draw', 0))
|
||||
start = int(request.args.get('start', 0))
|
||||
|
@ -197,7 +197,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()
|
||||
|
@ -218,7 +218,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':
|
||||
|
@ -261,7 +261,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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue