diff --git a/realms/__init__.py b/realms/__init__.py index 8c4c571..ee4f6b2 100644 --- a/realms/__init__.py +++ b/realms/__init__.py @@ -180,9 +180,10 @@ def create_app(config=None): db.Model = declarative_base(metaclass=HookModelMeta, cls=HookMixin) - for status_code in httplib.responses: - if status_code >= 400: - app.register_error_handler(status_code, error_handler) + # TODO: This caused a crash with a more recent flask. Figure out what it does. + # for status_code in httplib.responses: + # if status_code >= 400: + # app.register_error_handler(status_code, error_handler) @app.before_request def init_g(): diff --git a/realms/modules/wiki/views.py b/realms/modules/wiki/views.py index a5a2e40..87db1d3 100644 --- a/realms/modules/wiki/views.py +++ b/realms/modules/wiki/views.py @@ -11,7 +11,7 @@ blueprint = Blueprint('wiki', __name__) @blueprint.route("/_commit//") 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) @@ -26,7 +26,7 @@ def commit(name, sha): @blueprint.route(r"/_compare//") 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) @@ -41,7 +41,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'): @@ -63,7 +63,7 @@ def revert(): @blueprint.route("/_history/") 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) @@ -165,7 +165,7 @@ def _tree_index(items, path=""): @blueprint.route("/_index", defaults={"path": ""}) @blueprint.route("/_index/") 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() @@ -186,7 +186,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("/") 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) diff --git a/realms/templates/layout.html b/realms/templates/layout.html index 4eb1717..a8ee14c 100644 --- a/realms/templates/layout.html +++ b/realms/templates/layout.html @@ -58,7 +58,7 @@ - {% if current_user.is_authenticated() %} + {% if current_user.is_authenticated %}