2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 09:57:22 +00:00

fixing cave slug <caveslug> issues

This commit is contained in:
2024-06-29 08:55:14 +03:00
parent 09dbe5b14b
commit 6d16f8f7ca
6 changed files with 35 additions and 19 deletions

View File

@@ -749,11 +749,14 @@ def read_cave(filename, mvf=None, cave=None):
# 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."
message = f" ! - More than one slug for a cave: {cave}, slugs: {slugs}."
DataIssue.objects.create(parser="caves", message=message, url=context)
print(message)
# slug = slugs[0]
# but ignore <caveslug> read from the file
slug = filename[:-5] # strip off the ".html" at the end of the filename
slugs = [slug]
#print(f"{filename=} {slug=}")
@@ -926,7 +929,7 @@ def readcaves():
with transaction.atomic():
print(" - Reading Caves from cave descriptions xml files")
mvscript = "mvscript.sh"
mvscript = "mvscript.sh" # in .gitignore so no problem creating it on server in /troggle/
with open(mvscript, "w") as mvf: # overwrite
mvf.write(f"cd {CAVEDESCRIPTIONS}\n")
for filename in next(os.walk(CAVEDESCRIPTIONS))[2]: # Should be a better way of getting a list of files