forked from expo/troggle
Enable svx view if url just misses off .svx
This commit is contained in:
@@ -159,7 +159,7 @@ class SvxForm(forms.Form):
|
|||||||
|
|
||||||
@ensure_csrf_cookie
|
@ensure_csrf_cookie
|
||||||
def svx(request, survex_file):
|
def svx(request, survex_file):
|
||||||
'''Displays a singhle survex file in an textarea window (using a javascript online editor to enable
|
'''Displays a single survex file in an textarea window (using a javascript online editor to enable
|
||||||
editing) with buttons which allow SAVE, check for DIFFerences from saved, and RUN (which runs the
|
editing) with buttons which allow SAVE, check for DIFFerences from saved, and RUN (which runs the
|
||||||
cavern executable and displays the output below the main textarea). Requires CSRF to be set upcorrect;ly, and requires permission to write to the filesystem.
|
cavern executable and displays the output below the main textarea). Requires CSRF to be set upcorrect;ly, and requires permission to write to the filesystem.
|
||||||
'''
|
'''
|
||||||
@@ -377,7 +377,8 @@ def survexcaveslist(request):
|
|||||||
def survexcavesingle(request, survex_cave):
|
def survexcavesingle(request, survex_cave):
|
||||||
'''parsing all the survex files of a single cave and showing that it's consistent and can find all
|
'''parsing all the survex files of a single cave and showing that it's consistent and can find all
|
||||||
the files and people. Should explicity fix the kataster number thing.
|
the files and people. Should explicity fix the kataster number thing.
|
||||||
kataster numbers are not unique across areas. Fix this.
|
kataster numbers are not unique across areas. This used to be a db constraint but we need to manage
|
||||||
|
this ourselves as we don't want the parser aborting with an error message.
|
||||||
|
|
||||||
Should use getCave() from models_caves
|
Should use getCave() from models_caves
|
||||||
'''
|
'''
|
||||||
@@ -389,6 +390,11 @@ def survexcavesingle(request, survex_cave):
|
|||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
# can get here if the survex file is in a directory labelled with unofficial number not kataster number.
|
# can get here if the survex file is in a directory labelled with unofficial number not kataster number.
|
||||||
# maybe - and _ mixed up, or CUCC-2017- instead of 2017-CUCC-, or CUCC2015DL01 . Let's not get carried away..
|
# maybe - and _ mixed up, or CUCC-2017- instead of 2017-CUCC-, or CUCC2015DL01 . Let's not get carried away..
|
||||||
|
|
||||||
|
# or it might be an exact search for a specific survefile but just missing the '.svx.
|
||||||
|
if (Path(survexdatasetpath) / Path(survex_cave + ".svx")).is_file():
|
||||||
|
return svx(request, survex_cave)
|
||||||
|
|
||||||
for unoff in [sc, sc.replace('-','_'), sc.replace('_','-'), sc.replace('-',''), sc.replace('_','')]:
|
for unoff in [sc, sc.replace('-','_'), sc.replace('_','-'), sc.replace('-',''), sc.replace('_','')]:
|
||||||
try:
|
try:
|
||||||
cave = Cave.objects.get(unofficial_number=unoff) # return on first one we find
|
cave = Cave.objects.get(unofficial_number=unoff) # return on first one we find
|
||||||
|
|||||||
Reference in New Issue
Block a user