summaryrefslogtreecommitdiffstats
path: root/parsers/caves.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2024-06-28 18:53:54 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2024-06-28 18:56:17 +0300
commit70bdb50ae7b6dd299de0570236171b4d8f5380aa (patch)
tree05a2409741d9bb52144e860fe54aecfeb1686375 /parsers/caves.py
parent03fa36576bbfc3a1c4119a91de39d29916db7ef9 (diff)
downloadtroggle-70bdb50ae7b6dd299de0570236171b4d8f5380aa.tar.gz
troggle-70bdb50ae7b6dd299de0570236171b4d8f5380aa.tar.bz2
troggle-70bdb50ae7b6dd299de0570236171b4d8f5380aa.zip
more fixes to cave_edit mess
Diffstat (limited to 'parsers/caves.py')
-rw-r--r--parsers/caves.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/parsers/caves.py b/parsers/caves.py
index e207b77..53ea9e1 100644
--- a/parsers/caves.py
+++ b/parsers/caves.py
@@ -724,7 +724,7 @@ def read_cave(filename, mvf=None, cave=None):
# Note: these are HTML files in the EXPOWEB repo, not from the loser repo.
fn = settings.CAVEDESCRIPTIONS / filename
- context = f"/cave_data/{filename}_edit" # the expo html editor, not the specialist cave data editor. oops.
+ context = f"/cave_data/{filename}_edit" # the expo html editor, not the specialist cave data editor. oops.FIX THIS
# print(f" - Reading Cave from cave descriptions file {fn}")
if not fn.exists():
@@ -744,12 +744,18 @@ def read_cave(filename, mvf=None, cave=None):
return None
cavecontents = cavecontentslist[0]
- slugs = getXML(cavecontents, "caveslug", maxItems=1, context=context)
+
+ # This should be ignored, we are using the filename not this <caveslug> field now
+ # New 2024 June 28th.
+ slugs = getXML(cavecontents, "caveslug", maxItems=1, context=context)
if len(slugs) > 1:
message = f" ! - More than one slug for a cave: {cave}, slugs: {slugs}. Ignoring all except first."
DataIssue.objects.create(parser="caves", message=message, url=context)
print(message)
- slug = slugs[0]
+ # slug = slugs[0]
+ slug = filename[:-5] # strip off the ".html" at the end of the filename
+ #print(f"{filename=} {slug=}")
+
non_public = getXMLmax1("non_public")
official_name = getXMLmax1("official_name")
@@ -770,7 +776,7 @@ def read_cave(filename, mvf=None, cave=None):
survex_file = getXMLmax1("survex_file")
description_file = getXMLmax1("description_file")
- contextguess = f"/{slug[0:4]}/{slug}_cave_edit/" # guess as we havent read areacode yet
+ contextguess = f"/{slug[0:4]}/{slug}_cave_edit/" # guess as we havent read areacode yet. This is used for error messages
manual_edit = True
if not cave: