summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/views_survex.py19
-rw-r--r--templates/svxfilecavelist.html2
2 files changed, 17 insertions, 4 deletions
diff --git a/core/views_survex.py b/core/views_survex.py
index 3b4fe43..76b4851 100644
--- a/core/views_survex.py
+++ b/core/views_survex.py
@@ -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()
+
+
diff --git a/templates/svxfilecavelist.html b/templates/svxfilecavelist.html
index 2f80d46..3eb0701 100644
--- a/templates/svxfilecavelist.html
+++ b/templates/svxfilecavelist.html
@@ -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>