2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 22:37:08 +00:00

Survex files subdirectories displayed differently

This commit is contained in:
Philip Sargent
2021-03-25 16:15:26 +00:00
parent 213ada4ae9
commit 8723d62add
4 changed files with 109 additions and 20 deletions

View File

@@ -368,8 +368,8 @@ def survexcaveslist(request):
lsurvdirobj = [ ]
for lsubsvx in dsubsvx:
lsurvdirobj.append(("caves-1623/"+cavedir+"/"+subdir+"/"+lsubsvx, lsubsvx))
if len(dsubsvx) > 1:
subsurvdirs.append((lsurvdirobj[0], lsurvdirobj[1:]))
if len(dsubsvx) >= 1:
subsurvdirs.append((subdir,lsurvdirobj[0], lsurvdirobj[0:])) # list now includes the first item too
subdircaves.append((cavedir, (survdirobj[0], survdirobj[1:]), subsurvdirs))
# multifile caves
@@ -381,27 +381,31 @@ def survexcaveslist(request):
return render_to_response('svxfilecavelist.html', {'settings': settings, "onefilecaves":onefilecaves, "multifilecaves":multifilecaves, "subdircaves":subdircaves })
# parsing all the survex files of a single cave and showing that it's consistent and can find all the files and people
# currently not showing Explorers or Titles. link test from SurvexFile page is "dates and explorers"
# Should explicity fix the kataster number thing.
def survexcavesingle(request, survex_cave):
print(">>>", survex_cave)
'''parsing all the survex files of a single cave and showing that it's consistent and can find all
the files and people. Currently not showing Explorers or Titles. link test from SurvexFile page
is "dates and explorers". Should explicity fix the kataster number thing.
'''
sc = survex_cave
breload = False
if breload:
parsers.survex.ReloadSurvexCave(survex_cave) # does not exit now, needs re-writing to work.
parsers.survex.ReloadSurvexCave(sc) # does not exit now, needs re-writing to work.
try:
cave = Cave.objects.get(kataster_number=survex_cave)
for survexdirectory in cave.survexdirectory_set.all:
print(">>> >>>", survexdirectory, flush=True)
cave = Cave.objects.get(kataster_number=sc)
return render_to_response('svxcavesingle.html', {'settings': settings, "cave":cave })
except ObjectDoesNotExist:
# can get here if the survex file is in a directory labelled with unofficial number not kataster number.
cave = Cave.objects.get(unofficial_number=survex_cave)
return render_to_response('svxcavesingle.html', {'settings': settings, "cave":cave })
# should produce useful error message for person trying to upload or manage survex files
# maybe - and _ mixed up, or CUCC-2017- instead of 2017-CUCC-, or CUCC2015DL01 ??
for unoff in [sc, sc.replace('-','_'), sc.replace('_','-')]:
try:
cave = Cave.objects.get(unofficial_number=unoff)
return render_to_response('svxcavesingle.html', {'settings': settings, "cave":cave })
except ObjectDoesNotExist:
continue
return render_to_response('svxcavesingle404.html', {'settings': settings, "cave":sc })
except:
raise Http404()
return render_to_response('svxcavesingle404.html', {'settings': settings, "cave":sc })