mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-01-31 07:22:32 +00:00
let exceptions bubble up
This commit is contained in:
parent
84e165b8fc
commit
0a3037f077
@ -39,7 +39,9 @@ todo='''- Move utility function into utils.py
|
||||
'''
|
||||
|
||||
def writetrogglefile(filepath, filecontent):
|
||||
'''Set permissions to rw-rw-r-- and commit the new saved file to git'''
|
||||
'''Set permissions to rw-rw-r-- and commit the new saved file to git
|
||||
Callers should handle exception PermissionsError explicitly
|
||||
'''
|
||||
filepath = Path(filepath)
|
||||
cwd = filepath.parent
|
||||
filename = filepath.name
|
||||
|
@ -359,14 +359,16 @@ def edit_cave(request, slug=None):
|
||||
for ceinst in ceinsts:
|
||||
ceinst.cave = cave
|
||||
ceinst.save()
|
||||
try:
|
||||
cave.writeDataFile()
|
||||
except PermissionError:
|
||||
message = f'CANNOT save this file.\nPERMISSIONS incorrectly set on server for this file {cave.filename}. Ask a nerd to fix this.'
|
||||
return render(request,'errors/generic.html', {'message': message})
|
||||
except:
|
||||
message = f'CANNOT git on server for this file {cave.filename}. Edits not saved.\nAsk a nerd to fix this.'
|
||||
return render(request,'errors/generic.html', {'message': message})
|
||||
cave.writeDataFile()
|
||||
# try:
|
||||
# cave.writeDataFile()
|
||||
# except PermissionError:
|
||||
# message = f'CANNOT save this file.\nPERMISSIONS incorrectly set on server for this file {cave.filename}. Ask a nerd to fix this.'
|
||||
# return render(request,'errors/generic.html', {'message': message})
|
||||
# leave other exeptions unhandled so that they bubble up to userinterface
|
||||
# except:
|
||||
# message = f'CANNOT git on server for this file {cave.filename}. Edits not saved.\nAsk a nerd to fix this.'
|
||||
# return render(request,'errors/generic.html', {'message': message})
|
||||
|
||||
return HttpResponseRedirect("/" + cave.url)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user