diff --git a/app.py b/app.py index 8ed97fd..46e4129 100755 --- a/app.py +++ b/app.py @@ -113,8 +113,9 @@ def init_profile(): def global_user(): g.user = wikidata_oauth.get_username() -@app.before_request -def get_blocks(): +def check_for_blocks(): + if hasattr(g, 'server_ip'): # already done + return hostname = app.config.get('HOSTNAME') if not hostname: return @@ -127,6 +128,11 @@ def get_blocks(): except Exception: pass +@app.before_request +def get_blocks(): + if app.config.get('SHOW_BLOCK_ALERT') is not False: + check_for_blocks() + @app.route('/find_more_setting') def flip_find_more(): session['no_find_more'] = not session.get('no_find_more') @@ -1075,6 +1081,7 @@ def wikidata_query_list(): @app.route('/report/blocks') def server_block_report(): + check_for_blocks() return render_template('block_report.html') diff --git a/templates/base.html b/templates/base.html index 748ab68..cc7c9f6 100644 --- a/templates/base.html +++ b/templates/base.html @@ -17,10 +17,12 @@
{% block nav %}{{ navbar() }}{% endblock %} -