track down url resoution error

This commit is contained in:
Philip Sargent 2022-07-20 10:08:23 +03:00
parent 9a395eafef
commit 2a7f1506c9

View File

@ -235,15 +235,10 @@ def rendercave(request, cave, slug, cave_id=''):
cave_id = slug # cave.unofficial_number cave_id = slug # cave.unofficial_number
context = {'cave_editable': True, 'settings': settings, 'cave': cave, 'cavepage': True, context = {'cave_editable': True, 'settings': settings, 'cave': cave, 'cavepage': True,
'cave_id': cave_id, 'svxstem': str(svxstem), 'svx3d':svx3d} 'cave_id': cave_id, 'svxstem': str(svxstem), 'svx3d':svx3d}
try:
# Do not catch any exceptions here: propagate up to caller
r = render(request, templatefile, context) # crashes here with NoReverseMatch if url not set up for 'edit_cave' in urls.py r = render(request, templatefile, context) # crashes here with NoReverseMatch if url not set up for 'edit_cave' in urls.py
return r return r
except NoReverseMatch:
raise
except:
raise
message = f'Failed to render cave: {slug}'
return render(request,'errors/generic.html', {'message': message})
def cavepage(request, karea, subpath): def cavepage(request, karea, subpath):
'''Displays a cave description page '''Displays a cave description page
@ -279,6 +274,7 @@ def cavepage(request, karea, subpath):
except NoReverseMatch: except NoReverseMatch:
raise raise
except: except:
raise
message = f'Failed to render cave: {kpath} (it does exist and is unique) because of a Django URL resolution error. Check urls.py.' message = f'Failed to render cave: {kpath} (it does exist and is unique) because of a Django URL resolution error. Check urls.py.'
return render(request,'errors/generic.html', {'message': message}) return render(request,'errors/generic.html', {'message': message})