mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +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.shortcuts import render_to_response, render
|
||||||
#from django.core.context_processors import csrf
|
#from django.core.context_processors import csrf
|
||||||
from django.template.context_processors import csrf
|
from django.template.context_processors import csrf
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.http import HttpResponse, Http404
|
from django.http import HttpResponse, Http404
|
||||||
|
|
||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
@ -295,6 +295,7 @@ def identifycavedircontents(gcavedir):
|
|||||||
|
|
||||||
# direct local non-database browsing through the svx file repositories
|
# direct local non-database browsing through the svx file repositories
|
||||||
# perhaps should use the database and have a reload button for it
|
# 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):
|
def survexcaveslist(request):
|
||||||
cavesdir = os.path.join(settings.SURVEX_DATA, "caves-1623")
|
cavesdir = os.path.join(settings.SURVEX_DATA, "caves-1623")
|
||||||
#cavesdircontents = { }
|
#cavesdircontents = { }
|
||||||
@ -312,6 +313,7 @@ def survexcaveslist(request):
|
|||||||
for num, cavedir in fnumlist:
|
for num, cavedir in fnumlist:
|
||||||
|
|
||||||
# these have sub dirs /cucc/ /arge/ /old/ but that is no reason to hide them in this webpage
|
# 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"]:
|
#if cavedir in ["144", "40"]:
|
||||||
# continue
|
# continue
|
||||||
|
|
||||||
@ -350,9 +352,20 @@ def survexcaveslist(request):
|
|||||||
# doesn't use recursion. just writes it twice
|
# doesn't use recursion. just writes it twice
|
||||||
|
|
||||||
# currently not showing Explorers or Titles. link test from SurvexFile page is "dates and explorers"
|
# 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):
|
def survexcavesingle(request, survex_cave):
|
||||||
breload = False
|
breload = False
|
||||||
cave = Cave.objects.get(kataster_number=survex_cave)
|
|
||||||
if breload:
|
if breload:
|
||||||
parsers.survex.ReloadSurvexCave(survex_cave) # does not exit now, needs re-writing to work.
|
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 %}
|
{% 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>
|
<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>
|
<h2 id="cdir">Caves with subdirectories</h2>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user