diff options
Diffstat (limited to 'ogcp')
-rw-r--r-- | ogcp/views.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index cc6c2a3..862cc3e 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1507,7 +1507,11 @@ def save_server(form): with open(filename, 'r+') as file: config = json.load(file) - config['SERVERS'].append(server_dict) + try: + config['SERVERS'].append(server_dict) + except KeyError: + config['SERVERS'] = list() + config['SERVERS'].append(server_dict) file.seek(0) json.dump(config, file, indent='\t') |