summaryrefslogtreecommitdiffstats
path: root/core/views/survex.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/views/survex.py')
-rw-r--r--core/views/survex.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/core/views/survex.py b/core/views/survex.py
index a69c5d3..b00aed0 100644
--- a/core/views/survex.py
+++ b/core/views/survex.py
@@ -574,15 +574,15 @@ def survexcaveslist(request):
subdircaves = []
fnumlist = []
- for area in ["1623", "1626", "1624", "1627"]:
- cavesdir = get_survexareapath(area)
- arealist = sorted([(area, -int(re.match(r"\d*", f).group(0) or "0"), f) for f in os.listdir(cavesdir)])
+ for areacode in ["1623", "1626", "1624", "1627"]:
+ cavesdir = get_survexareapath(areacode)
+ arealist = sorted([(areacode, -int(re.match(r"\d*", f).group(0) or "0"), f) for f in os.listdir(cavesdir)])
fnumlist += arealist
# print(fnumlist)
# go through the list and identify the contents of each cave directory
- for area, num, cavedir in fnumlist:
+ for areacode, num, cavedir in fnumlist:
# these have sub dirs /cucc/ /arge/ /old/ but that is no reason to hide them in this webpage
# so these are now treated the same as 142 and 113 which also have a /cucc/ sub dir
@@ -593,18 +593,17 @@ def survexcaveslist(request):
# which usually but not always true. e.g. caves-1623/78/allkaese.svx not caves-1623/78/78.svx
# which is why we now also pass through the cavedir
- # Still fails for loutitohoehle etc even though this is set correctly when the pending cave is created
- cavesdir = get_survexareapath(area)
+ cavesdir = get_survexareapath(areacode)
gcavedir = os.path.join(cavesdir, cavedir)
if os.path.isdir(gcavedir) and cavedir[0] != ".":
subdirs, subsvx = identifycavedircontents(gcavedir)
check_cave_registered(
- area, cavedir
+ areacode, cavedir
) # should do this only once per database load or it will be slow
survdirobj = []
for lsubsvx in subsvx:
- survdirobj.append(("caves-" + area + "/" + cavedir + "/" + lsubsvx, lsubsvx))
+ survdirobj.append(("caves-" + areacode + "/" + cavedir + "/" + lsubsvx, lsubsvx))
# caves with subdirectories
if subdirs:
@@ -614,7 +613,7 @@ def survexcaveslist(request):
# assert not dsubdirs # handle case of empty sub directory
lsurvdirobj = []
for lsubsvx in dsubsvx:
- lsurvdirobj.append(("caves-" + area + "/" + cavedir + "/" + subdir + "/" + lsubsvx, lsubsvx))
+ lsurvdirobj.append(("caves-" + areacode + "/" + cavedir + "/" + subdir + "/" + lsubsvx, lsubsvx))
if len(dsubsvx) >= 1:
subsurvdirs.append(
(subdir, lsurvdirobj[0], lsurvdirobj[0:])
@@ -683,7 +682,7 @@ def survexcavesingle(request, cave_shortname):
else:
return render(request, "errors/svxcaves404.html", {"settings": settings, "cave": cave_shortname})
-def check_cave_registered(area, survex_cave):
+def check_cave_registered(areacode, survex_cave):
"""Checks whether a cave has been properly registered when it is found in the Loser repo
This should really be called by databaseReset not here in a view
Currently Caves are only registered if they are listed in :expoweb: settings.CAVEDESCRIPTIONS
@@ -699,7 +698,7 @@ def check_cave_registered(area, survex_cave):
except MultipleObjectsReturned:
caves = Cave.objects.filter(kataster_number=survex_cave)
for c in caves:
- if str(c) == area + "-" + survex_cave:
+ if str(c) == areacode + "-" + survex_cave:
return str(c) # just get the first that matches
return None # many returned but none in correct area