2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 19:47:11 +00:00

making error handling mroe robust

This commit is contained in:
2025-01-16 17:36:24 +00:00
parent eb22047c08
commit d2fade5a3d
2 changed files with 6 additions and 6 deletions

View File

@@ -718,7 +718,7 @@ def read_cave(filename, mvf=None, cave=None):
if dir.is_dir():
return
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=}\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."
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, or simply edit the line <unofficial_number> in cave_data/{caveid}.html."
DataIssue.objects.create(parser="caves", message=message, url=f"{cave.newslug()}_cave_edit/")
print(message)
return
@@ -734,7 +734,7 @@ def read_cave(filename, mvf=None, cave=None):
if kataster_number:
if slug == f"{areacode}-{kataster_number}":
return slug
message = f" ! Cave Slug mismatch (kataster): '{slug}' != '{areacode}-{kataster_number}' {url=} in file {filename}. IGNORING caveslug field in the .html file."
message = f" ! Cave Slug mismatch (kataster): '{slug}' != '{areacode}-{kataster_number}' {url=} in file {filename}. IGNORING caveslug field in the .html file. "
correctslug = f"{areacode}-{kataster_number}"
else:
@@ -748,12 +748,12 @@ def read_cave(filename, mvf=None, cave=None):
correctslug = f"{areacode}-{unofficial_number}"
msgurl=f"/{correctslug[0:4]}/{correctslug}_cave_edit/"
DataIssue.objects.create(parser="caves", message=message, url=msgurl) # url here is for the href link to edit the bad data in the DataIssues page
DataIssue.objects.update_or_create(parser="caves", message=message, url=msgurl) # url here is for the href link to edit the bad data in the DataIssues page
mvtext = f"mv {filename} {correctslug}.html"
#print(mvtext)
if filename != f"{correctslug}.html" :
message = f" ! Filename is not the same as the cave slug '{slug}' != '{areacode}-{unofficial_number}' {url=} in file {filename} IGNORING caveslug field in the .html file."
DataIssue.objects.create(parser="caves", message=message, url=msgurl) # url here is for where the file actually is, for editing
message = f" ! Filename is not the same as the cave slug '{slug}' != '{areacode}-{unofficial_number}' {url=} in file {filename} IGNORING <unofficial_number> field in the .html file and using the filename to get the cave slug instead."
DataIssue.objects.update_or_create(parser="caves", message=message, url=msgurl) # url here is for where the file actually is, for editing
if mvf: # this can be called online, not just when a databaseReset is done, so mvf may be None
mvf.write(mvtext + "\n")
print(message)