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 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: