mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
catch crashes when no data has been imported
This commit is contained in:
parent
6452a7beed
commit
785845598f
@ -84,7 +84,11 @@ def expedition(request, expeditionname):
|
||||
#print('! - expo {expeditionanme} using cached page')
|
||||
return render(request,'expedition.html', { **ts[expeditionname], 'logged_in' : logged_in })
|
||||
|
||||
this_expedition = Expedition.objects.get(year=int(expeditionname))
|
||||
try:
|
||||
this_expedition = Expedition.objects.get(year=int(expeditionname))
|
||||
except:
|
||||
message = f'Expedition not found - database apparently empty, you probably need to do a full re-import of all data.'
|
||||
return render(request, 'errors/generic.html', {'message': message})
|
||||
|
||||
expeditions = Expedition.objects.all()
|
||||
personexpeditiondays = [ ]
|
||||
|
@ -515,8 +515,13 @@ def scanupload(request, path=None):
|
||||
f = Path(settings.SURVEX_DATA) / svx
|
||||
if f.is_file():
|
||||
path = svx.parent / svx.stem
|
||||
#print(f' - {path=}')
|
||||
svxfile = SurvexFile.objects.get(path=path)
|
||||
#print(f' - {path=}')
|
||||
try:
|
||||
svxfile = SurvexFile.objects.get(path=path)
|
||||
except:
|
||||
message = f'Specified survex file not found - database apparently empty, you probably need to do a full re-import of all data.'
|
||||
return render(request, 'errors/generic.html', {'message': message})
|
||||
|
||||
print(f' - {svxfile=}')
|
||||
caves.append(svxfile.cave)
|
||||
caverefs.append(svxfile.cave.reference())
|
||||
|
Loading…
Reference in New Issue
Block a user