2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 08:41:51 +00:00

more fixes to cave_edit mess

This commit is contained in:
Philip Sargent 2024-06-28 18:53:54 +03:00
parent 03fa36576b
commit 70bdb50ae7

View File

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