mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-01-31 15:32:35 +00:00
Enable svx view if url just misses off .svx
This commit is contained in:
parent
f6f83c6f70
commit
dbd9b1a095
@ -159,7 +159,7 @@ class SvxForm(forms.Form):
|
||||
|
||||
@ensure_csrf_cookie
|
||||
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
|
||||
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):
|
||||
'''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.
|
||||
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
|
||||
'''
|
||||
@ -389,6 +390,11 @@ def survexcavesingle(request, survex_cave):
|
||||
except ObjectDoesNotExist:
|
||||
# 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..
|
||||
|
||||
# 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('_','')]:
|
||||
try:
|
||||
cave = Cave.objects.get(unofficial_number=unoff) # return on first one we find
|
||||
|
Loading…
Reference in New Issue
Block a user