2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

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?
This commit is contained in:
Martin Green 2023-04-30 21:06:57 +01:00
parent e8d1265ee4
commit c50236575f

View File

@ -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.""" Entrance field either missing or holds a null string instead of a filename in a cave_data file."""
global entrances_xslug global entrances_xslug
try: try:
entrance = dummy_entrance(id, slug, msg="DUMMY") #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
entrances_xslug[slug] = entrance #entrance = dummy_entrance(id, slug, msg="DUMMY")
#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 #entrances_xslug[slug] = entrance
#CaveAndEntrance.objects.update_or_create(cave=cave, entrance_letter="", entrance=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: Dummy Entrance successfully set for entrance {id} on cave {cave}"
message = f" - Note: Missing Entrance for entrance {id} on cave {cave}" message = f" - Note: Missing Entrance for entrance {id} on cave {cave}"