summaryrefslogtreecommitdiffstats
path: root/core/views_survex.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/views_survex.py')
-rw-r--r--core/views_survex.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/core/views_survex.py b/core/views_survex.py
index 9fc334a..7375bb7 100644
--- a/core/views_survex.py
+++ b/core/views_survex.py
@@ -40,6 +40,62 @@ survextemplatefile = """; Locn: Totes Gebirge, Austria - Loser/Augst-Eck Plateau
*end [surveyname]"""
+
+def millenialcaves(request):
+ cavesdir = os.path.join(settings.SURVEX_DATA, "caves-1623")
+ #cavesdircontents = { }
+
+ onefilecaves = [ ]
+ multifilecaves = [ ]
+ subdircaves = [ ]
+
+ millenialcaves = [ ]
+
+
+ # go through the list and identify the contents of each cave directory
+ for cavedir in os.listdir(cavesdir):
+ if cavedir in ["144", "40"]: #????? RW
+ continue
+
+ gcavedir = os.path.join(cavesdir, cavedir) #directory od 'large' cave
+
+ if os.path.isdir(gcavedir) and cavedir[0] != ".":
+ subdirs, subsvx = identifycavedircontents(gcavedir)
+ survdirobj = [ ]
+
+ for lsubsvx in subsvx:
+ survdirobj.append(("caves-1623/"+cavedir+"/"+lsubsvx, lsubsvx))
+
+ # caves with subdirectories
+ if subdirs:
+ subsurvdirs = [ ]
+ for subdir in subdirs:
+ dsubdirs, dsubsvx = identifycavedircontents(os.path.join(gcavedir, subdir))
+ assert not dsubdirs
+ lsurvdirobj = [ ]
+ for lsubsvx in dsubsvx:
+ lsurvdirobj.append(("caves-1623/"+cavedir+"/"+subdir+"/"+lsubsvx, lsubsvx))
+ subsurvdirs.append((lsurvdirobj[0], lsurvdirobj[1:]))
+ subdircaves.append((cavedir, (survdirobj[0], survdirobj[1:]), subsurvdirs))
+
+ # multifile caves
+ elif len(survdirobj) > 1:
+ multifilecaves.append((survdirobj[0], survdirobj[1:]))
+ # single file caves
+ else:
+ #print("survdirobj = ")
+ #print(survdirobj)
+ onefilecaves.append(survdirobj[0])
+
+ caves = Cave.objects.all()
+
+ return render_to_response('millenialcaves.html', {'settings': settings , 'caves':caves , "onefilecaves":onefilecaves, "multifilecaves":multifilecaves, "subdircaves":subdircaves })
+
+
+
+
+
+
def ReplaceTabs(stext):
res = [ ]