Removed kataster area for unoffical numbers of pending caves. Added .html to urls of pending caves.

This commit is contained in:
Martin Green 2023-07-05 18:21:15 +01:00
parent 2b30b7b624
commit a0fcb78e95

View File

@ -146,10 +146,10 @@ def create_new_cave(svxpath):
# double check
if a[0:3] == "162":
areanum = a[0:4]
url = f"{areanum}/{a[5:]}" # Note we are not appending the .htm as we are modern folks now.
url = f"{areanum}/{a[5:]}.html" # Note we are appending the .html as we are believe in backwards compatability.
else:
areanum = "1623"
url = f"1623/{k}"
url = f"1623/{k}.html"
k = f"{areanum}-{caveid}"
area = get_area(areanum)
@ -162,7 +162,7 @@ def create_new_cave(svxpath):
return caves[0]
try:
cave = do_pending_cave(k, url, area)
cave = do_pending_cave(k, caveid, url, area)
except:
message = f" ! Error. Cannot create pending cave and entrance, pending-id:{k} in area {areanum}"
DataIssue.objects.create(parser="caves", message=message)
@ -174,7 +174,7 @@ def create_new_cave(svxpath):
cave.save()
return cave
def do_pending_cave(k, url, area):
def do_pending_cave(k, caveid, url, area):
"""
default for a PENDING cave, should be overwritten in the db later if a real cave of the same name exists
in expoweb/cave_data/1623-"k".html
@ -266,7 +266,7 @@ def do_pending_cave(k, url, area):
survex_file = get_survex_file(k)
cave = Cave(
unofficial_number=k,
unofficial_number=caveid,
underground_description="Pending cave write-up - creating as empty object. No XML file available yet.",
survex_file=survex_file,
url=url,
@ -718,14 +718,16 @@ def readcaves():
if k[0:3] == "162":
areanum = k[0:4]
url = f"{areanum}/{k[5:]}" # Note we are not appending the .htm as we are modern folks now.
number = k[5:]
url = f"{areanum}/{k[5:]}.html" # Note we are appending the .htm to allow for offline websites
else:
areanum = "1623"
number = k
url = f"1623/{k}"
area = get_area(areanum)
try:
do_pending_cave(k, url, area)
do_pending_cave(k, number, url, area)
except:
message = f" ! Error. Cannot create pending cave and entrance, pending-id:{k} in area {areanum}"
DataIssue.objects.create(parser="caves", message=message)