[damned-lies/develop: 22/23] chore: add a warning when deploying on pre-production instance




commit 1859edf582570e233acc50b49e8d78916a51c348
Author: Guillaume Bernard <associations guillaume-bernard fr>
Date:   Sat Sep 4 18:32:54 2021 +0200

    chore: add a warning when deploying on pre-production instance

 damnedlies/context_processors.py | 13 +++++++++++++
 templates/base.html              |  6 ++++++
 2 files changed, 19 insertions(+)
---
diff --git a/damnedlies/context_processors.py b/damnedlies/context_processors.py
new file mode 100644
index 00000000..6cb52051
--- /dev/null
+++ b/damnedlies/context_processors.py
@@ -0,0 +1,13 @@
+
+def running_integration_instance(request):
+    running_pre_production = False
+    try:
+        from django.conf import settings
+
+        if settings.PRE_PRODUCTION_INSTANCE and isinstance(settings.PRE_PRODUCTION_INSTANCE, bool):
+            running_pre_production = settings.PRE_PRODUCTION_INSTANCE
+    except (ImportError, AttributeError):
+        pass
+    return {
+        "RUNNING_PRE_PRODUCTION": running_pre_production,
+    }
diff --git a/templates/base.html b/templates/base.html
index 391b0390..8cdc9791 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -68,6 +68,12 @@
     </div>
 </header>
 
+{% if RUNNING_PRE_PRODUCTION is True %}
+    <div class="system-message">
+        <p class="text-warning errornote">This is a preproduction instance of GNOME Damned Lies. If you wish 
to contribute to GNOME, please, move to the official GNOME Damned Lies application at <a 
href="https://l10n.gnome.org";>l10n.gnome.org</a>.</p>
+    </div>
+{% endif %}
+
 <div class="clearfix"></div>
 
 <div id="content" class="container gnome-content">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]