From 1f656b2101c54c3728a6d94a92ce8efe9c64d258 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Wed, 26 Jul 2023 01:23:49 +0300 Subject: [PATCH] properly turn off automagic entrance creation --- parsers/caves.py | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/parsers/caves.py b/parsers/caves.py index 93d5cff..5304599 100644 --- a/parsers/caves.py +++ b/parsers/caves.py @@ -85,23 +85,18 @@ def set_dummy_entrance(id, slug, cave, msg="DUMMY"): so """ global entrances_xslug - message = f" - Note: Missing Entrance for entrance '{id}' on cave '{cave}'" + message = f" - Note: Missing Entrance for entrance '{id}' on cave '{cave}' - Is this a problem?" DataIssue.objects.create(parser="entrances", message=message, url=f"{cave.url}") - try: - # I am not sure if we want entrances automagically created. - # Therefore I have commented it out. MJG - - # Automagic restored, as it creates a load of error message in the DataIssue log. 2023-07-25 - # pending doing this properly, ie. properly creating an XML file for each of these pending caves. - - entrance = dummy_entrance(id, slug, msg="DUMMY") - entrances_xslug[slug] = entrance - CaveAndEntrance.objects.update_or_create(cave=cave, entrance_letter="", entrance=entrance) - pass - except: - message = f' ! Entrance Dummy setting failure, slug:"{slug}" cave id :"{id}" ' - DataIssue.objects.create(parser="entrances", message=message, url=f"{cave.url}") - print(message) + + # try: + # entrance = dummy_entrance(id, slug, msg="DUMMY") + # entrances_xslug[slug] = entrance + # CaveAndEntrance.objects.update_or_create(cave=cave, entrance_letter="", entrance=entrance) + # pass + # except: + # message = f' ! Entrance Dummy setting failure, slug:"{slug}" cave id :"{id}" ' + # DataIssue.objects.create(parser="entrances", message=message, url=f"{cave.url}") + # print(message) def make_areas(): print(" - Creating Areas 1623, 1624, 1627 and 1626") @@ -298,7 +293,9 @@ def do_pending_cave(k, caveid, url, area): print(message) try: - set_dummy_entrance(k, slug, cave, msg="PENDING") + # troggle is more robust against missing entrances now, not needed. + # set_dummy_entrance(k, slug, cave, msg="PENDING") + pass except: message = f" ! {k:11s} PENDING entrance + cave UNION create failure '{cave}' [{slug}] {k}" # message = f" ! {k:11s} PENDING entrance + cave UNION create failure '{cave}' [{ent}]" @@ -726,7 +723,7 @@ def readcaves(): DataIssue.objects.filter(parser="areas").delete() DataIssue.objects.filter(parser="caves").delete() DataIssue.objects.filter(parser="caves ok").delete() - DataIssue.objects.filter(parser="entrances").delete() + #DataIssue.objects.filter(parser="entrances").delete() with transaction.atomic(): area = get_area("1623") @@ -766,7 +763,7 @@ def readcaves(): try: do_pending_cave(k, number, url, area) except: - message = f" ! Error. Cannot create pending cave and entrance, pending-id:{k} in area {areanum}" + message = f" ! Error. Cannot create pending cave, pending-id:{k} in area {areanum}" DataIssue.objects.create(parser="caves", message=message) print(message) raise