From 012be929a6a088fd085dd46bcd2f2e834fdeb73a Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 12 2019 12:11:58 +0000 Subject: Make the main_app variable accessible to all templates This way both the settings page and the sidebar can rely on it being available. Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/flask_app.py b/pagure/flask_app.py index b6dbcd3..8c31e08 100644 --- a/pagure/flask_app.py +++ b/pagure/flask_app.py @@ -241,6 +241,7 @@ def set_request(): flask.current_app.config["DB_URL"] ) + flask.g.main_app = flask.current_app flask.g.version = pagure.__version__ flask.g.confirmationform = pagure.forms.ConfirmationForm() diff --git a/pagure/templates/settings.html b/pagure/templates/settings.html index 5c93c25..24ee38d 100644 --- a/pagure/templates/settings.html +++ b/pagure/templates/settings.html @@ -104,7 +104,7 @@ href="#deleteproject-tab" role="tab" aria-controls="deleteproject">Delete Project {% endif %} - {% for blueprint in main_app.blueprints %} + {% for blueprint in g.main_app.blueprints %} {% if blueprint | hasattr('settings') %}  Releases - {% if 'distgit_ns' in main_app.blueprints and not repo.is_fork %} + {% if 'distgit_ns' in g.main_app.blueprints and not repo.is_fork %}

Monitoring status:

diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index db1b3c6..40fc975 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -1262,7 +1262,6 @@ def view_settings(repo, username=None, namespace=None): plugins=plugins, branchname=branchname, pagure_admin=pagure.utils.is_admin(), - main_app=flask.current_app, )