From 3359889d97d5c165a10a4576a3ee40e3fc9f1d7d Mon Sep 17 00:00:00 2001 From: Martin Green <martin.speleo@gmail.com> Date: Sat, 8 Jul 2023 17:56:49 +0200 Subject: [PATCH] Better attempt at creating a default url for caves created by svx files --- parsers/caves.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/parsers/caves.py b/parsers/caves.py index 5c6b5ac..b376801 100644 --- a/parsers/caves.py +++ b/parsers/caves.py @@ -146,10 +146,13 @@ def create_new_cave(svxpath): # double check if a[0:3] == "162": areanum = a[0:4] - url = f"{areanum}/{a[5:]}.html" # Note we are appending the .html as we are believe in backwards compatability. - else: + url = f"{areanum}/{caveid}.html" # Note we are appending the .html as we are believe in backwards compatability. + #url = f"{areanum}/{a[5:]}.html" # This is original code, but a above is only defined as being 4 characters long, so it did not make sense and produced non unique urls + else: + print(f"WARNING: parsers/caves/create_new_cave called with svxpath '{svxpath}'. Surely it should start 'caves-162*'?") areanum = "1623" - url = f"1623/{k}.html" + url = f"1623/{caveid}.html" + #url = f"1623/{k}.html" # This is original code, but a above is only defined as being 4 characters long, so it did not make sense and produced non unique urls k = f"{areanum}-{caveid}" area = get_area(areanum)