mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
Trying to make kataster renumbering easier
This commit is contained in:
parent
f156b89f32
commit
36ef9f961d
@ -684,16 +684,21 @@ def read_cave(filename, cave=None):
|
|||||||
def check_slug(areacode, kataster_number, unofficial_number, url):
|
def check_slug(areacode, kataster_number, unofficial_number, url):
|
||||||
if kataster_number:
|
if kataster_number:
|
||||||
if slug == f"{areacode}-{kataster_number}":
|
if slug == f"{areacode}-{kataster_number}":
|
||||||
return
|
return slug
|
||||||
message = f" ! Cave Slug mismatch (kataster): '{slug}' != '{areacode}-{kataster_number}' {url=} in file {filename}"
|
message = f" ! Cave Slug mismatch (kataster): '{slug}' != '{areacode}-{kataster_number}' {url=} in file {filename}. Adjusting.."
|
||||||
|
correctslug = f"{areacode}-{kataster_number}"
|
||||||
else:
|
else:
|
||||||
if slug == f"{areacode}-{unofficial_number}":
|
if slug == f"{areacode}-{unofficial_number}":
|
||||||
return
|
return slug
|
||||||
message = f" ! Cave Slug mismatch (unofficial): '{slug}' != '{areacode}-{unofficial_number}' {url=} in file {filename}"
|
|
||||||
if slug.lower() == f"{areacode}-{unofficial_number.lower()}":
|
if slug.lower() == f"{areacode}-{unofficial_number.lower()}":
|
||||||
message = f" ! Cave Slug capitalisation incorrect (unofficial): '{slug}' != '{areacode}-{unofficial_number}' {url=} in file {filename}"
|
message = f" ! Cave Slug capitalisation incorrect (unofficial): '{slug}' != '{areacode}-{unofficial_number}' {url=} in file {filename}"
|
||||||
|
correctslug = slug.lower()
|
||||||
|
else:
|
||||||
|
message = f" ! Cave Slug mismatch (unofficial): '{slug}' != '{areacode}-{unofficial_number}' {url=} in file {filename}"
|
||||||
|
correctslug = slug # hack to stopit crashing
|
||||||
DataIssue.objects.create(parser="caves", message=message, url=f"{cave.slug}_cave_edit/")
|
DataIssue.objects.create(parser="caves", message=message, url=f"{cave.slug}_cave_edit/")
|
||||||
print(message)
|
print(message)
|
||||||
|
return correctslug
|
||||||
|
|
||||||
global entrances_xslug
|
global entrances_xslug
|
||||||
global caves_xslug
|
global caves_xslug
|
||||||
@ -809,7 +814,8 @@ def read_cave(filename, cave=None):
|
|||||||
cave.url = f"{cave.areacode}/{cave.number()}/{cave.number()}.html"
|
cave.url = f"{cave.areacode}/{cave.number()}/{cave.number()}.html"
|
||||||
check_directory(cave.areacode, cave.number(), cave.url, cave)
|
check_directory(cave.areacode, cave.number(), cave.url, cave)
|
||||||
|
|
||||||
check_slug(cave.areacode,cave.kataster_number, cave.unofficial_number, cave.url)
|
# This next line has no effect because the cave slug is not actually a field on the Cave object so we can't fix it here. to-do.
|
||||||
|
slug = check_slug(cave.areacode,cave.kataster_number, cave.unofficial_number, cave.url)
|
||||||
|
|
||||||
entrances = getXML(cavecontents, "entrance", context=context)
|
entrances = getXML(cavecontents, "entrance", context=context)
|
||||||
do_entrances()
|
do_entrances()
|
||||||
|
Loading…
Reference in New Issue
Block a user