summaryrefslogtreecommitdiffstats
path: root/core/views/expo.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2021-12-30 21:13:34 +0000
committerPhilip Sargent <philip.sargent@klebos.com>2021-12-30 21:13:34 +0000
commitb359937eabd383351e8863d80c785f05da029ab4 (patch)
tree2e842f6d7755522e50f930a0e72ea6434a637dda /core/views/expo.py
parentc0545b8777914d5b116a76252b03c4a7fb5ce576 (diff)
downloadtroggle-b359937eabd383351e8863d80c785f05da029ab4.tar.gz
troggle-b359937eabd383351e8863d80c785f05da029ab4.tar.bz2
troggle-b359937eabd383351e8863d80c785f05da029ab4.zip
remove chmod attempt
Diffstat (limited to 'core/views/expo.py')
-rw-r--r--core/views/expo.py9
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})