2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 12:27:05 +00:00

remove chmod attempt

This commit is contained in:
Philip Sargent
2021-12-30 21:13:34 +00:00
parent c0545b8777
commit b359937eab
3 changed files with 23 additions and 19 deletions

View File

@@ -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})