From c50236575f656ac397946d30a85a112cc675cdb6 Mon Sep 17 00:00:00 2001 From: Martin Green Date: Sun, 30 Apr 2023 21:06:57 +0100 Subject: [PATCH] Dummy entrances were being written to a global variable, recording that they have a filename. But the filename was not written. This was then causing an exception when the user asked to edit a cave, leading to all entrances being reread. Obviously the dummy entrances file ould not be read. PS. Do we really want to reread all entrances when we start editing a cave? --- parsers/caves.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parsers/caves.py b/parsers/caves.py index fbe9788..8a611ec 100644 --- a/parsers/caves.py +++ b/parsers/caves.py @@ -73,9 +73,9 @@ def set_dummy_entrance(id, slug, cave, msg="DUMMY"): Entrance field either missing or holds a null string instead of a filename in a cave_data file.""" global entrances_xslug try: - entrance = dummy_entrance(id, slug, msg="DUMMY") - entrances_xslug[slug] = entrance - #Note the below line, just creates a dastabase entry and not a file, this then breaks entrance editing by the website. I am not sure if we want entrances automagically created. Therefore I have commented it out. MJG + #Note the below line, just creates a dastabase entry, sets the global variable entrances_xslug and not a file, this then breaks entrance editing by the website. I am not sure if we want entrances automagically created. Therefore I have commented it out. Perhaps entrances_xslug is being saved with the worng filename, breaking edit_caves. MJG + #entrance = dummy_entrance(id, slug, msg="DUMMY") + #entrances_xslug[slug] = entrance #CaveAndEntrance.objects.update_or_create(cave=cave, entrance_letter="", entrance=entrance) #message = f" - Note: Dummy Entrance successfully set for entrance {id} on cave {cave}" message = f" - Note: Missing Entrance for entrance {id} on cave {cave}"