From 1f18af1208ede0b16da393641e7e1386690e7aa5 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Mon, 27 May 2024 10:35:10 +0200 Subject: views: prevent backtrace when no server is available Define the timestamp in the codepath executed when no server is found active. Prevent the web to show a backtrace because the timestamp variable is used but not defined as it is only created when a server is found. --- ogcp/views.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ogcp/views.py b/ogcp/views.py index 32beb3e..b31d8dc 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -420,6 +420,7 @@ def index(): time_dict = {'now': now, 'boot': boot, 'start': start} dashboard_servers[server_id]['time_dict'] = time_dict else: + timestamp = datetime.datetime.today() dashboard_servers[server.id] = {} dashboard_servers[server.id]['online'] = False dashboard_servers[server.id]['name'] = server.name -- cgit v1.2.3-18-g5258