summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwookey <devnull@localhost>2013-06-24 23:32:12 +0100
committerwookey <devnull@localhost>2013-06-24 23:32:12 +0100
commite49e22b37cf89ebeec7ec11e99a4e42b8881a3e4 (patch)
tree60ad0d1eadad5c949b09e9985f9eb4aa6591f899
parent82e69b4f0575d16d99de0f6f4bdbf7dbc9123454 (diff)
downloadtroggle-e49e22b37cf89ebeec7ec11e99a4e42b8881a3e4.tar.gz
troggle-e49e22b37cf89ebeec7ec11e99a4e42b8881a3e4.tar.bz2
troggle-e49e22b37cf89ebeec7ec11e99a4e42b8881a3e4.zip
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.
-rw-r--r--core/views_survex.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/core/views_survex.py b/core/views_survex.py
index 95bdc70..852dd25 100644
--- a/core/views_survex.py
+++ b/core/views_survex.py
@@ -213,6 +213,11 @@ def err(request, survex_file):
def identifycavedircontents(gcavedir):
# 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]
subdirs = [ ]
subsvx = [ ]
@@ -231,7 +236,7 @@ def identifycavedircontents(gcavedir):
elif f[-4:] == ".svx":
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 nf[:3] == "all":
assert primesvx[:3] != "all", (name, nf, primesvx, gcavedir, subsvx)
@@ -242,10 +247,15 @@ def identifycavedircontents(gcavedir):
primesvx = nf
else:
subsvx.append(nf)
- else:
- assert re.match(".*?(?:.3d|.log|.err|.txt|.tmp|.diff|.e?spec|~)$", f), (gcavedir, f)
+ #else:
+ # 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()
- 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:
subsvx.insert(0, primesvx)
return subdirs, subsvx