mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-15 18:57:13 +00:00
trap bug that Tom B found
This commit is contained in:
@@ -2652,10 +2652,20 @@ def parse_one_file(fpath): # --------------------------------------in progress--
|
||||
"""
|
||||
cave = find_cave_from_path(svxpath)
|
||||
if cave:
|
||||
cave_svxpath = cave.survex_file[:-4] # remove .svx
|
||||
fileroot = SurvexFile.objects.get(path=cave_svxpath)
|
||||
print(f" - Setting the root survexfile for this import: {svxpath} to be that for cave {cave}")
|
||||
if cave.survex_file: # i.e. cave has been fully created and has a value for this
|
||||
cave_svxpath = cave.survex_file[:-4] # remove .svx
|
||||
else:
|
||||
cave.survex_file = svxpath + ".svx"
|
||||
save(cave)
|
||||
cave_svxpath = svxpath
|
||||
try:
|
||||
fileroot = SurvexFile.objects.get(path=cave_svxpath)
|
||||
except:
|
||||
fileroot = SurvexFile.objects.create(path=cave_svxpath, cave=cave)
|
||||
print(f" !! - No SurvexFile object found for {svxpath=}, making a new one..")
|
||||
print(f" - Setting the root survexfile for this import: {svxpath} to be that for cave {cave} {cave.survex_file=}")
|
||||
return fileroot
|
||||
|
||||
|
||||
# make a dummy SurvexFile object, which will be removed later
|
||||
dummyroot = SurvexFile(path=svxpath)
|
||||
|
||||
Reference in New Issue
Block a user