obscure bug empty directory inside empty directory

This commit is contained in:
Philip Sargent 2023-03-05 23:55:00 +00:00
parent 63dde36389
commit 8f3b329552

View File

@ -30,10 +30,16 @@ but also displays data on a cave or caves when there is ambiguity
todo = """- survexcavesingle is not properly producing any result for Homecoming, 1626-359, 2018-dm-07
even though there are dozens of surveys.
- REFACTOR the very impenetrable code for scanningsubdirectories, replace with modern python pathlib
- filter out the non-public caves from display UNLESS LOGGED IN
- Never actual uses the object for the survexfile, works entirely from the filepath! Make it check and validate
- the primary survex file in each cave directory should be in a configuration, not buried in the code...
- Save the edited survexfile as a survexfile object and re-parse it, and update
all its dependencies
all its dependencies (work in progress)
"""
survexdatasetpath = Path(settings.SURVEX_DATA)
@ -452,8 +458,12 @@ def err(request, survex_file):
def identifycavedircontents(gcavedir):
# find the primary survex file in each cave directory
# this should be in a configuration, not buried in the code...
"""
find the primary survex file in each cave directory
this should be in a configuration, not buried in the code...
For gods sake someone refactor this monstrosity using pathlib
"""
name = os.path.split(gcavedir)[1]
subdirs = []
subsvx = []
@ -508,6 +518,8 @@ def survexcaveslist(request):
"""This reads the entire list of caves in the Loser repo directory and produces a complete report.
It can find caves which have not yet been properly registered in the system by Databasereset.py because
someone may have uploaded the survex files without doing the rest of the integration process.
It uses very impenetrable code in identifycavedircontents()
"""
# TO DO - filter out the non-public caves from display UNLESS LOGGED IN
# This is very impenetrable code, original from Aaron Curtis I think.
@ -561,7 +573,10 @@ def survexcaveslist(request):
subsurvdirs.append(
(subdir, lsurvdirobj[0], lsurvdirobj[0:])
) # list now includes the first item too
subdircaves.append((cavedir, (survdirobj[0], survdirobj[1:]), subsurvdirs))
if survdirobj:
subdircaves.append((cavedir, (survdirobj[0], survdirobj[1:]), subsurvdirs))
else:
print(f" ! Subdirectory containing empty subdirectory {subdirs} in {gcavedir}")
# multifile caves
elif len(survdirobj) > 1: