diff options
Diffstat (limited to 'core/views/expo.py')
-rw-r--r-- | core/views/expo.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/views/expo.py b/core/views/expo.py index 1acee15..6c79771 100644 --- a/core/views/expo.py +++ b/core/views/expo.py @@ -312,15 +312,18 @@ def editexpopage(request, path): git = settings.GIT try: with open(filepath, "w") as f: - os.chmod(filepath, 0o664) # set file permissions to rw-rw-r-- - f.write(result) print(f'WRITING{cwd}---{filename} ') + # as the wsgi process www-data, we have group write-access but are not owner, so cannot chmod. + # os.chmod(filepath, 0o664) # set file permissions to rw-rw-r-- + # see also core/models/cave.py writetrogglefile() + f.write(result) + # should replace .call with .run and capture_output=True subprocess.call([git, "add", filename], cwd=cwd) subprocess.call([git, "commit", "-m", 'Edit this page'], cwd=cwd) except PermissionError: message = f'CANNOT save this file.\nPERMISSIONS incorrectly set on server for this file {filename}. Ask a nerd to fix this.' return render(request,'errors/generic.html', {'message': message}) - except: + except SubprocessError: message = f'CANNOT git on server for this file {filename}. Edits not saved.\nAsk a nerd to fix this.' return render(request,'errors/generic.html', {'message': message}) |