From 4a47543a0fdf02e6cdf33db03c9f809e52be117d Mon Sep 17 00:00:00 2001 From: realaravinth Date: Fri, 1 Jul 2022 20:59:10 +0530 Subject: [PATCH] hostfix: use default source code link when settings.py doesn't provide one --- dash/utils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dash/utils.py b/dash/utils.py index 99d45d0..f54a96a 100644 --- a/dash/utils.py +++ b/dash/utils.py @@ -65,7 +65,14 @@ source_code = None def footer_ctx(): global source_code if source_code is None: - source_code = {"text": "Source Code", "link": settings.HOSTEA["SOURCE_CODE"]} + if "SOURCE_CODE" in settings.HOSTEA: + source_code = { + "text": "Source Code", + "link": settings.HOSTEA["SOURCE_CODE"], + } + else: + link = "https://gitea.hostea.org/Hostea/dashboard" + source_code = {"text": "Source Code", "link": link} try: r = Repo(".") commit = r.head.commit.hexsha