mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-17 07:47:20 +00:00
using filename for entrance_slug not the <slug> field in entrance_data file
This commit is contained in:
@@ -484,7 +484,6 @@ def read_entrance(filename, ent=None):
|
||||
print(message)
|
||||
|
||||
|
||||
|
||||
# Derive the letter, entrance slug and cave slug fromthe filename
|
||||
entslug_fn = filename[:-5]
|
||||
if entslug_fn[-1] in LETTERS:
|
||||
@@ -617,9 +616,9 @@ def read_cave(filename, mvf=None, cave=None):
|
||||
eslug = getXML(e, "entranceslug", maxItems=1, context=context)[0]
|
||||
# if eslug.endswith(('a','b','c','d','e','f')):
|
||||
# print(f"! Entrance {eslug}")
|
||||
if eslug.endswith('a b'):
|
||||
message = f' - Entrance has weird name slug:"{eslug}" cave:"{cave}" caveslug:"{slug}" filename:"cave_data/{filename}"'
|
||||
DataIssue.objects.create(parser="xEntrances", message=message, url=f"{cave.url}_cave_edit/")
|
||||
# if eslug.endswith('a b'):
|
||||
# message = f' - Entrance has weird name slug:"{eslug}" cave:"{cave}" caveslug:"{slug}" filename:"cave_data/{filename}"'
|
||||
# DataIssue.objects.create(parser="xEntrances", message=message, url=f"{cave.url}_cave_edit/")
|
||||
# print(message)
|
||||
|
||||
letter = getXML(e, "letter", maxItems=1, context=context)[0]
|
||||
@@ -837,6 +836,7 @@ def read_cave(filename, mvf=None, cave=None):
|
||||
# From here on the code applies to both edited and newly-imported caves (mostly!)
|
||||
do_caveslugstuff() # needs cave!=None
|
||||
|
||||
# We no longer need the <area> tag to define 1623 etc as we get that from the filename.
|
||||
areas = getXML(cavecontents, "area", context=contextguess) # can be multiple <area> tags
|
||||
for area_slug in areas:
|
||||
if area_slug in AREACODES: # ignore sub areas which are in another <area> tag
|
||||
@@ -873,6 +873,7 @@ def read_cave(filename, mvf=None, cave=None):
|
||||
|
||||
slug = check_slug(cave.areacode, cave.kataster_number, cave.unofficial_number, cave.url) #NB cave.slug is not a field on Cave
|
||||
|
||||
# Thsi whole way of doing entrances can be replaced by simply knowing formthe entrance_data filename what the cave is.
|
||||
entrances = getXML(cavecontents, "entrance", context=context)
|
||||
do_entrances()
|
||||
# print(f"- {entrances_xslug=}")
|
||||
|
||||
Reference in New Issue
Block a user