mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-16 11:07:15 +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)
|
cave = find_cave_from_path(svxpath)
|
||||||
if cave:
|
if cave:
|
||||||
cave_svxpath = cave.survex_file[:-4] # remove .svx
|
if cave.survex_file: # i.e. cave has been fully created and has a value for this
|
||||||
fileroot = SurvexFile.objects.get(path=cave_svxpath)
|
cave_svxpath = cave.survex_file[:-4] # remove .svx
|
||||||
print(f" - Setting the root survexfile for this import: {svxpath} to be that for cave {cave}")
|
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
|
return fileroot
|
||||||
|
|
||||||
|
|
||||||
# make a dummy SurvexFile object, which will be removed later
|
# make a dummy SurvexFile object, which will be removed later
|
||||||
dummyroot = SurvexFile(path=svxpath)
|
dummyroot = SurvexFile(path=svxpath)
|
||||||
|
|||||||
Reference in New Issue
Block a user