diff options
-rw-r--r-- | core/models/caves.py | 4 | ||||
-rw-r--r-- | core/views/caves.py | 18 |
2 files changed, 13 insertions, 9 deletions
diff --git a/core/models/caves.py b/core/models/caves.py index 263eaf1..313935a 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -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 diff --git a/core/views/caves.py b/core/views/caves.py index 8824425..c8ee7e8 100644 --- a/core/views/caves.py +++ b/core/views/caves.py @@ -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: |