2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-01-19 09:22:32 +00:00

Check the url field too

This commit is contained in:
Philip Sargent 2023-09-26 01:26:50 +03:00
parent d4cf76da40
commit cf6ba7568f

View File

@ -648,18 +648,18 @@ def read_cave(filename, cave=None):
print(message)
primary = False
def check_slug(areacode, kataster_number, unofficial_number):
def check_slug(areacode, kataster_number, unofficial_number, url):
if kataster_number:
if slug == f"{areacode}-{kataster_number}":
return
message = f" ! Cave Slug incorrect (kataster): '{slug}' != '{areacode}-{kataster_number}' in file {filename}"
message = f" ! Cave Slug incorrect (kataster): '{slug}' != '{areacode}-{kataster_number}' {url=} in file {filename}"
else:
if slug == f"{areacode}-{unofficial_number}":
return
message = f" ! Cave Slug incorrect (unofficial): '{slug}' != '{areacode}-{unofficial_number}' in file {filename}"
message = f" ! Cave Slug incorrect (unofficial): '{slug}' != '{areacode}-{unofficial_number}' {url=} in file {filename}"
if slug.lower() == f"{areacode}-{unofficial_number.lower()}":
message = f" ! Cave Slug capitalisation incorrect (unofficial): {slug} != {areacode}-{unofficial_number} in file {filename}"
DataIssue.objects.create(parser="caves", message=message, url=f"{cave.url}_cave_edit/")
message = f" ! Cave Slug capitalisation incorrect (unofficial): '{slug}' != '{areacode}-{unofficial_number}' {url=} in file {filename}"
DataIssue.objects.create(parser="caves", message=message, url=f"{cave.slug}_cave_edit/")
print(message)
global entrances_xslug
@ -773,7 +773,7 @@ def read_cave(filename, cave=None):
cave.description_file=description_file[0]
cave.url=url[0]
check_slug(cave.areacode,cave.kataster_number, cave.unofficial_number)
check_slug(cave.areacode,cave.kataster_number, cave.unofficial_number, cave.url)
entrances = getXML(cavecontents, "entrance", context=context)
do_entrances()