2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

bug in getting cave slug

This commit is contained in:
Philip Sargent 2023-10-16 13:35:56 +03:00
parent 6b94829315
commit bf8bf7b3d2

View File

@ -553,26 +553,32 @@ def walletedit(request, path=None):
if not type(survex_paths) == list: # a string also is a sequence type, so do it this way
survex_paths = [survex_paths]
for svxf in survex_paths:
if not svxf: # not a blank string
for svxfl in survex_paths:
if not svxfl: # not a blank string
continue
# print(f" - - {svxf=} ")
svx = Path(svxf)
if svx.suffix.lower() != ".svx":
svx = svx.with_suffix(".svx")
f = Path(settings.SURVEX_DATA) / svx
svxf = Path(svxfl)
if svxf.suffix.lower() != ".svx":
svxf = svx.with_suffix(".svx")
f = Path(settings.SURVEX_DATA) / svxf
if not f.is_file():
message = f"Specified survex file '{fpath}' in database not found on disc"
print(message)
continue
fpath = svx.parent / svx.stem
fpath = svxf.parent / svxf.stem
# print(f' - {fpath=}')
try:
svxfile = SurvexFile.objects.get(path=fpath)
except:
message = f"Specified survex file '{fpath}'not found? database may be empty. Exception."
print(message)
# This failure will also get picked up by the "S" colour code red or orange
try:
if svxfile.cave:
caves.append(svxfile.cave)
cave_refs.append(svxfile.cave.reference()) # this is a string?!
cave_refs.append(svxfile.cave.slug()) # this is a string?!
w, d, n, t = scan_survexblocks(svxfile)
@ -581,7 +587,7 @@ def walletedit(request, path=None):
names.extend(n)
team.extend(t)
except:
message = "Specified survex file not found - database may be empty."
message = f"Exception wallet handling for {fpath} '{svxfile.cave}' "
print(message)
# This failure will also get picked up by the "S" colour code red or orange