2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-18 18:47:06 +00:00

fixed bug when extra unneeded ent file exists

This commit is contained in:
2025-09-27 11:01:16 +03:00
parent 4138dd0671
commit d455b9aee7

View File

@@ -920,7 +920,8 @@ def read_cave(filename, mvf=None, cave=None):
slug = check_slug(cave.areacode, cave.kataster_number, cave.unofficial_number, cave.url) #NB cave.slug is not a field on Cave
# Thsi whole way of doing entrances can be replaced by simply knowing the entrance_data filename what the cave is. to do.
# Thsi whole way of doing entrances can be replaced by simply knowing the entrance_data filename what the cave is. TO DO.
# This also fails if there are more entance_data files for a cave tahn the cave_data file knows about.
entrances = getXML(cavecontents, "entrance", context=context)
#do_entrances()
if not entrances or len(entrances) < 1:
@@ -1015,6 +1016,15 @@ def readcaves():
if filename.endswith(".html"):
read_cave(filename, mvf)
# check entrances all have caves associated with them
for e in Entrance.objects.all():
if not e.firstcave():
message = f' ! No cave associated with entrance {e.slug} in {ENTRANCEDESCRIPTIONS}/{e.filename}. Deleting the Entrance object.'
DataIssue.objects.create(parser="entrances", message=message, url=f"/{e.slug}")
print(message)
e.delete()
print(" - Setting up all the variously useful alias names")
GetCaveLookup()