mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-16 06:57:12 +00:00
debugging Cave page links..
This commit is contained in:
@@ -557,7 +557,8 @@ def get_survexareapath(area):
|
||||
# direct local non-database browsing through the svx file repositories
|
||||
# every time the page is viewed! Should cache this.
|
||||
def survexcaveslist(request):
|
||||
"""This reads the entire list of caves in the Loser repo directory and produces a complete report.
|
||||
"""NEEDS REWRITING COMPLETELY
|
||||
This reads the entire list of caves in the Loser repo directory and produces a complete report.
|
||||
It can find caves which have not yet been properly registered in the system by Databasereset.py because
|
||||
someone may have uploaded the survex files with git without doing the rest of the integration process.
|
||||
|
||||
@@ -566,6 +567,8 @@ def survexcaveslist(request):
|
||||
what is already in the db, and just construct: onefilecaves, multifilecaves, subdircaves.
|
||||
|
||||
It uses very impenetrable code in identifycavedircontents()
|
||||
|
||||
It is MISSING some caves, e.g. "LA34" should appear twice, as 1623 and 1626.
|
||||
"""
|
||||
# TO DO - filter out the non-public caves from display UNLESS LOGGED IN
|
||||
# This is very impenetrable code, original from Aaron Curtis I think.
|
||||
@@ -692,11 +695,11 @@ def check_cave_registered(areacode, survex_cave):
|
||||
A serious bodge.
|
||||
"""
|
||||
try:
|
||||
cave = Cave.objects.get(kataster_number=survex_cave)
|
||||
cave = Cave.objects.get(areacode=areacode, kataster_number=survex_cave)
|
||||
return str(cave)
|
||||
|
||||
except MultipleObjectsReturned:
|
||||
caves = Cave.objects.filter(kataster_number=survex_cave)
|
||||
caves = Cave.objects.filter(areacode=areacode, kataster_number=survex_cave)
|
||||
for c in caves:
|
||||
if str(c) == areacode + "-" + survex_cave:
|
||||
return str(c) # just get the first that matches
|
||||
@@ -706,11 +709,14 @@ def check_cave_registered(areacode, survex_cave):
|
||||
pass
|
||||
|
||||
try:
|
||||
cave = Cave.objects.get(unofficial_number=survex_cave) # should be unique!
|
||||
if cave.kataster_number:
|
||||
return str(cave)
|
||||
else:
|
||||
return None
|
||||
cave = Cave.objects.get(areacode=areacode, unofficial_number=survex_cave) # Not unique, e.g. LA34
|
||||
return str(cave)
|
||||
except MultipleObjectsReturned:
|
||||
caves = Cave.objects.filter(areacode=areacode,unofficial_number=survex_cave)
|
||||
for c in caves:
|
||||
if str(c) == areacode + "-" + survex_cave:
|
||||
return str(c) # just get the first that matches
|
||||
return None # many returned but none in correct area
|
||||
except ObjectDoesNotExist:
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user