summaryrefslogtreecommitdiffstats
path: root/parsers/caves.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-11-07 23:23:15 +0200
committerPhilip Sargent <philip.sargent@gmail.com>2023-11-07 23:23:15 +0200
commit1e8a5bea6e50986218ecd550ce4978a967900970 (patch)
treef6cf789702ad44c368f6167364ba55c247ca776b /parsers/caves.py
parent1ba37665b5ff17c92e2fc7d3587c166ffd79af96 (diff)
downloadtroggle-1e8a5bea6e50986218ecd550ce4978a967900970.tar.gz
troggle-1e8a5bea6e50986218ecd550ce4978a967900970.tar.bz2
troggle-1e8a5bea6e50986218ecd550ce4978a967900970.zip
ent.url removed and entrance edit path simplified
Diffstat (limited to 'parsers/caves.py')
-rw-r--r--parsers/caves.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/parsers/caves.py b/parsers/caves.py
index 4580e82..de843ae 100644
--- a/parsers/caves.py
+++ b/parsers/caves.py
@@ -551,10 +551,9 @@ def read_entrance(filename, ent=None):
ent.other_description=other_description[0]
ent.other_station=other_station[0]
ent.photo=photo[0]
- # ent.slug=slugs[0]
+ # ent.slug=slugs[0] # set algorithically
ent.tag_station=tag_station[0]
ent.underground_description=underground_description[0]
- ent.url=url[0]
for st in [ent.other_station, ent.tag_station]:
#validate_station(st)
@@ -604,12 +603,15 @@ def read_cave(filename, cave=None):
letter = getXML(e, "letter", maxItems=1, context=context)[0]
if len(entrances) > 1 and letter =="":
- # user error, but we can recover
+ # Usually the second entrance is 'b', but the first is still unlettered. So probably 'a'
letter = eslug[-1].lower()
if letter.lower() not in list(string.ascii_lowercase):
- letter = "x"
- message = f"- Warning - Empty 'letter' field for '{eslug}' in multiple-entrance cave '{cave}', setting to {letter}."
- DataIssue.objects.create(parser="entrances", message=message, url=f"{cave.url}_cave_edit/")
+ letter = "a"
+ message = f"- Warning - Empty 'letter' field for '{eslug}' in multiple-entrance cave '{cave}', setting to {letter}."
+ #eurl = f"{cave.url}_cave_edit/"
+ eurl = Path(cave.url).parent + f"{cave.slug()}_cave_edit/"
+ # edit recognizer: (?P<path>.*)/(?P<slug>[^/]+)_cave_edit/$
+ DataIssue.objects.create(parser="entrances", message=message, url=eurl)
print(message)
if len(entrances) == 1 and not eslug: # may be empty: <entranceslug></entranceslug>
@@ -821,8 +823,7 @@ def read_cave(filename, cave=None):
cave.extent=extent[0]
cave.survex_file=survex_file[0]
cave.description_file=description_file[0]
- # cave.url=url[0]
- # override url in file. We now have a standard canonical form:
+ # cave.url=url[0] # set algorithically:
cave.url = f"{cave.areacode}/{cave.number()}/{cave.number()}.html"
check_directory(cave.areacode, cave.number(), cave.url, cave)