summaryrefslogtreecommitdiffstats
path: root/parsers/caves.py
diff options
context:
space:
mode:
authorMartin Green <martin.speleo@gmail.com>2023-07-05 18:21:15 +0100
committerMartin Green <martin.speleo@gmail.com>2023-07-05 18:21:15 +0100
commita0fcb78e95e4585fc358fe94af3735e2f39332d0 (patch)
tree899025fe49f0f41299e855d6ca2fd618925cdd62 /parsers/caves.py
parent2b30b7b624e220ed2c0ef9915fe63f9d12ab3a38 (diff)
downloadtroggle-a0fcb78e95e4585fc358fe94af3735e2f39332d0.tar.gz
troggle-a0fcb78e95e4585fc358fe94af3735e2f39332d0.tar.bz2
troggle-a0fcb78e95e4585fc358fe94af3735e2f39332d0.zip
Removed kataster area for unoffical numbers of pending caves. Added .html to urls of pending caves.
Diffstat (limited to 'parsers/caves.py')
-rw-r--r--parsers/caves.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/parsers/caves.py b/parsers/caves.py
index 06b77c9..5c6b5ac 100644
--- a/parsers/caves.py
+++ b/parsers/caves.py
@@ -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)