summaryrefslogtreecommitdiffstats
path: root/parsers/caves.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2024-06-30 20:38:02 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2024-06-30 20:38:02 +0300
commit8e1cf1021d8b398c4c59fff7c20719a53a72c3ac (patch)
tree9a128796203fe1c72c3799bad7b6efe44ee9a7a7 /parsers/caves.py
parent6789d4f627167344b88c3ec33788cbdace6258da (diff)
downloadtroggle-8e1cf1021d8b398c4c59fff7c20719a53a72c3ac.tar.gz
troggle-8e1cf1021d8b398c4c59fff7c20719a53a72c3ac.tar.bz2
troggle-8e1cf1021d8b398c4c59fff7c20719a53a72c3ac.zip
using filename for entrance_slug not the <slug> field in entrance_data file
Diffstat (limited to 'parsers/caves.py')
-rw-r--r--parsers/caves.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/parsers/caves.py b/parsers/caves.py
index f9c9b61..c2559d4 100644
--- a/parsers/caves.py
+++ b/parsers/caves.py
@@ -484,7 +484,6 @@ def read_entrance(filename, ent=None):
print(message)
-
# Derive the letter, entrance slug and cave slug fromthe filename
entslug_fn = filename[:-5]
if entslug_fn[-1] in LETTERS:
@@ -617,9 +616,9 @@ def read_cave(filename, mvf=None, cave=None):
eslug = getXML(e, "entranceslug", maxItems=1, context=context)[0]
# if eslug.endswith(('a','b','c','d','e','f')):
# print(f"! Entrance {eslug}")
- if eslug.endswith('a b'):
- message = f' - Entrance has weird name slug:"{eslug}" cave:"{cave}" caveslug:"{slug}" filename:"cave_data/{filename}"'
- DataIssue.objects.create(parser="xEntrances", message=message, url=f"{cave.url}_cave_edit/")
+ # if eslug.endswith('a b'):
+ # message = f' - Entrance has weird name slug:"{eslug}" cave:"{cave}" caveslug:"{slug}" filename:"cave_data/{filename}"'
+ # DataIssue.objects.create(parser="xEntrances", message=message, url=f"{cave.url}_cave_edit/")
# print(message)
letter = getXML(e, "letter", maxItems=1, context=context)[0]
@@ -837,6 +836,7 @@ def read_cave(filename, mvf=None, cave=None):
# From here on the code applies to both edited and newly-imported caves (mostly!)
do_caveslugstuff() # needs cave!=None
+ # We no longer need the <area> tag to define 1623 etc as we get that from the filename.
areas = getXML(cavecontents, "area", context=contextguess) # can be multiple <area> tags
for area_slug in areas:
if area_slug in AREACODES: # ignore sub areas which are in another <area> tag
@@ -873,6 +873,7 @@ 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 formthe entrance_data filename what the cave is.
entrances = getXML(cavecontents, "entrance", context=context)
do_entrances()
# print(f"- {entrances_xslug=}")