mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
now robust re svx in folders unofficial numbers
This commit is contained in:
parent
4e00645851
commit
a9fa251fee
@ -8,7 +8,7 @@ from django.http import HttpResponseRedirect, HttpResponse
|
||||
from django.shortcuts import render_to_response, render
|
||||
#from django.core.context_processors import csrf
|
||||
from django.template.context_processors import csrf
|
||||
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.http import HttpResponse, Http404
|
||||
|
||||
import troggle.settings as settings
|
||||
@ -295,6 +295,7 @@ def identifycavedircontents(gcavedir):
|
||||
|
||||
# direct local non-database browsing through the svx file repositories
|
||||
# perhaps should use the database and have a reload button for it
|
||||
# why is caves-1623 HARD CODED here ?! That must be wrong..
|
||||
def survexcaveslist(request):
|
||||
cavesdir = os.path.join(settings.SURVEX_DATA, "caves-1623")
|
||||
#cavesdircontents = { }
|
||||
@ -312,6 +313,7 @@ def survexcaveslist(request):
|
||||
for 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 had a /cucc/ sub dir
|
||||
#if cavedir in ["144", "40"]:
|
||||
# continue
|
||||
|
||||
@ -350,9 +352,20 @@ def survexcaveslist(request):
|
||||
# doesn't use recursion. just writes it twice
|
||||
|
||||
# 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):
|
||||
breload = False
|
||||
cave = Cave.objects.get(kataster_number=survex_cave)
|
||||
if breload:
|
||||
parsers.survex.ReloadSurvexCave(survex_cave) # does not exit now, needs re-writing to work.
|
||||
return render_to_response('svxcavesingle.html', {'settings': settings, "cave":cave })
|
||||
try:
|
||||
cave = Cave.objects.get(kataster_number=survex_cave)
|
||||
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
|
||||
except:
|
||||
raise Http404()
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
{% block content %}
|
||||
<p><a href="#cdir">caves with subdirectories</a> | <a href="#cmult">caves with multiple files</a> | <a href="#csing">caves with single files</a></p>
|
||||
|
||||
<h3><a href="/survexfile/all.svx">Link to all.svx for processing</a></h3>
|
||||
<!-- <h3><a href="/survexfile/all.svx">Link to all.svx for processing</a></h3> <!-- This is not right...-->
|
||||
|
||||
<h2 id="cdir">Caves with subdirectories</h2>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user