2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-26 01:01:53 +00:00

fix messages

This commit is contained in:
Philip Sargent 2024-06-29 12:10:35 +03:00
parent 313d4bde30
commit 897cdf9aee

View File

@ -579,7 +579,9 @@ def read_cave(filename, mvf=None, cave=None):
def do_entrances(): def do_entrances():
"""For both bulk import and individual re-reading of cave_data file, """For both bulk import and individual re-reading of cave_data file,
fix the entrances fix the entrances
What is Class CaveAndEntrance for?
What is Class CaveAndEntrance for? It was to allow mandy<=>many relationship between caves and entrances, but now we insist
only one Cave for any Entrance, so this Class is reduncdant and should be removed..
""" """
for e in entrances: for e in entrances:
@ -619,9 +621,10 @@ def read_cave(filename, mvf=None, cave=None):
entrance = Entrance.objects.get(slug=eslug) entrance = Entrance.objects.get(slug=eslug)
entrances_xslug[eslug] = entrance entrances_xslug[eslug] = entrance
except: except:
message = f"! Fail entrance loading {eslug} /entrance_data/{eslug} file does not exist or loading it failed." message = f"! Fail entrance loading {eslug} /entrance_data/{eslug} file does not exist or loading it from {filename} failed."
DataIssue.objects.create(parser="entrances", message=message, url=f"{cave.url}_cave_edit/") DataIssue.objects.create(parser="entrances", message=message, url=f"{cave.url}_cave_edit/")
print(message) print(message)
print(e)
return return
if eslug != f"{entrance}": if eslug != f"{entrance}":
@ -675,8 +678,8 @@ def read_cave(filename, mvf=None, cave=None):
if dir.is_dir(): if dir.is_dir():
return return
if dir_l.is_dir() or dir_u.is_dir(): if dir_l.is_dir() or dir_u.is_dir():
message = f" ! Cave URL capitalisation incorrect '{dir}' is not a directory but different capitalisation is. {url=} " message = f" ! Cave URL capitalisation incorrect '{dir}' is not a directory but different capitalisation is. {url=}\n - Fix by renaming cave_data/{caveid}.html which determines the cave id OR by renaming the directory and hand-fixing all the links to the files in the cave description."
DataIssue.objects.create(parser="caves", message=message, url=f"{cave.slug()}_cave_edit/") DataIssue.objects.create(parser="caves", message=message, url=f"{cave.newslug()}_cave_edit/")
print(message) print(message)
return return
if cave.filename: if cave.filename:
@ -745,13 +748,13 @@ def read_cave(filename, mvf=None, cave=None):
cavecontents = cavecontentslist[0] cavecontents = cavecontentslist[0]
# This should be ignored, we are using the filename not this <caveslug> field now # This is ignored, we are using the filename not this <caveslug> field now
# New 2024 June 28th. # New 2024 June 28th.
slugs = getXML(cavecontents, "caveslug", maxItems=1, context=context) # slugs = getXML(cavecontents, "caveslug", maxItems=1, context=context)
if len(slugs) > 1: # if len(slugs) > 1:
message = f" ! - More than one slug for a cave: {cave}, slugs: {slugs}." # message = f" ! - More than one slug for a cave: {cave}, slugs: {slugs}."
DataIssue.objects.create(parser="caves", message=message, url=context) # DataIssue.objects.create(parser="caves", message=message, url=context)
print(message) # print(message)
# slug = slugs[0] # slug = slugs[0]
# but ignore <caveslug> read from the file # but ignore <caveslug> read from the file