forked from expo/troggle
Removed asserts which meant that if any 'odd' .svx files, or directories
with no obvious 'controlling' svx file, were added to the dataset then the survex viewer code exploded and the website didn't work. It's wrong that adding a new cave with an oddly-named .svx file can break the website in this way, so these asserts are wrong.
This commit is contained in:
parent
00bd49ef2c
commit
8badd8b556
@ -213,6 +213,11 @@ def err(request, survex_file):
|
|||||||
|
|
||||||
def identifycavedircontents(gcavedir):
|
def identifycavedircontents(gcavedir):
|
||||||
# find the primary survex file in each cave directory
|
# find the primary survex file in each cave directory
|
||||||
|
# name is the directory, nf is the base name of the file we are currently trying
|
||||||
|
# primesvx is the 'controlling' .svx for this dir. This code currently wrongly assumes that every dir has one
|
||||||
|
# The in-scan exceptions are a bad idea.
|
||||||
|
# subsvx is all the svx files in this dir, with 'primesvx' listed first
|
||||||
|
# subdirs is sibdirs of the current dir.
|
||||||
name = os.path.split(gcavedir)[1]
|
name = os.path.split(gcavedir)[1]
|
||||||
subdirs = [ ]
|
subdirs = [ ]
|
||||||
subsvx = [ ]
|
subsvx = [ ]
|
||||||
@ -231,7 +236,7 @@ def identifycavedircontents(gcavedir):
|
|||||||
elif f[-4:] == ".svx":
|
elif f[-4:] == ".svx":
|
||||||
nf = f[:-4]
|
nf = f[:-4]
|
||||||
|
|
||||||
if nf.lower() == name.lower() or nf[:3] == "all" or (name, nf) in [("resurvey2005", "145-2005"), ("cucc", "cu115")]:
|
if nf.lower() == name.lower() or nf[:3] == "all" or (name, nf) in [("resurvey2005", "145-2005"),("cucc","142"),("cucc","cu115")]:
|
||||||
if primesvx:
|
if primesvx:
|
||||||
if nf[:3] == "all":
|
if nf[:3] == "all":
|
||||||
assert primesvx[:3] != "all", (name, nf, primesvx, gcavedir, subsvx)
|
assert primesvx[:3] != "all", (name, nf, primesvx, gcavedir, subsvx)
|
||||||
@ -242,10 +247,15 @@ def identifycavedircontents(gcavedir):
|
|||||||
primesvx = nf
|
primesvx = nf
|
||||||
else:
|
else:
|
||||||
subsvx.append(nf)
|
subsvx.append(nf)
|
||||||
else:
|
#else:
|
||||||
assert re.match(".*?(?:.3d|.log|.err|.txt|.tmp|.diff|.e?spec|~)$", f), (gcavedir, f)
|
# This assert means that having a .ods file in the dir is fatal - that's not a good thing
|
||||||
|
# so commented out [W]
|
||||||
|
#assert re.match(".*?(?:.3d|.log|.err|.txt|.tmp|.diff|.e?spec|~)$", f), (gcavedir, f)
|
||||||
subsvx.sort()
|
subsvx.sort()
|
||||||
assert primesvx, (gcavedir, subsvx)
|
#If this code fails then _no_ survey files are vieable.
|
||||||
|
#This assert means that any wierd file someone checks in to the dataset can make _everything_ unveiwable.
|
||||||
|
#If we don't grok it then just skip it.?
|
||||||
|
#assert primesvx, (gcavedir, subsvx)
|
||||||
if primesvx:
|
if primesvx:
|
||||||
subsvx.insert(0, primesvx)
|
subsvx.insert(0, primesvx)
|
||||||
return subdirs, subsvx
|
return subdirs, subsvx
|
||||||
|
Loading…
Reference in New Issue
Block a user