2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

using filename for entrance_slug not the <slug> field in entrance_data file

This commit is contained in:
Philip Sargent 2024-06-30 20:38:02 +03:00
parent 6789d4f627
commit 8e1cf1021d
3 changed files with 7 additions and 5 deletions

View File

@ -208,6 +208,7 @@ class Wallet(models.Model):
if not (Path(settings.SURVEX_DATA) / sx).is_file():
message=f"{self} Survex file {sx} was not found in LOSER repo"
DataIssue.objects.update_or_create(parser="wallets", message=message, url=wurl)
# check using <kataster> field on the cave whether it has been renamed...
def allcaves(self):
"""Called when parsing importing all data. Called on all new wallets, but before

View File

@ -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=}")

View File

@ -46,7 +46,7 @@ at troggle/core/forms.py ass this uses a Django magic form creation thinggy. -->
{{ent.bearings|safe}}</td></tr>
{% endif %}
</table>
<p><input type="submit" value="Submit" /></p>
<p><input style="font-weight: bold; font-size: 200%; font-variant-caps: small-caps; margin-left: 40%;" type="submit" value="Submit" /></p>
</form>
{% endblock %}