From 4f3c66f04aebf3d571c3ba14f525b0e9a1dc1d55 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Thu, 22 Sep 2022 17:42:33 +0200 Subject: Fix ogServer deletion from the configuration file Otherwise, users can not remove from the web a server declared in the deprecated way. --- ogcp/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ogcp/views.py b/ogcp/views.py index 862cc3e..9374606 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1534,7 +1534,12 @@ def delete_server(server): with open(filename, 'r+') as file: config = json.load(file) - config['SERVERS'].remove(server_dict) + try: + config['SERVERS'].remove(server_dict) + except (KeyError, ValueError): + config.pop('IP') + config.pop('PORT') + config.pop('API_TOKEN') file.seek(0) json.dump(config, file, indent='\t') -- cgit v1.2.3-18-g5258