summaryrefslogtreecommitdiffstats
path: root/core/models/caves.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/models/caves.py
parentc0545b8777914d5b116a76252b03c4a7fb5ce576 (diff)
downloadtroggle-b359937eabd383351e8863d80c785f05da029ab4.tar.gz
troggle-b359937eabd383351e8863d80c785f05da029ab4.tar.bz2
troggle-b359937eabd383351e8863d80c785f05da029ab4.zip
remove chmod attempt
Diffstat (limited to 'core/models/caves.py')
-rw-r--r--core/models/caves.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/models/caves.py b/core/models/caves.py
index 91ec492..d023f48 100644
--- a/core/models/caves.py
+++ b/core/models/caves.py
@@ -42,18 +42,19 @@ def writetrogglefile(filepath, filecontent):
'''Set permissions to rw-rw-r-- and commit the new saved file to git
Callers to cave.writeDataFile() or entrance.writeDataFile() should handle the exception PermissionsError explicitly
'''
+ # see also core/views/expo.py editexpopage()
filepath = Path(filepath)
cwd = filepath.parent
filename = filepath.name
git = settings.GIT
+ # as the wsgi process www-data, we have group write-access but are not owner, so cannot chmod.
# do not trap exceptions, pass them up to the view that called this function
- # if the os.chmod fails, it can zero the contents of the file as a side effect. Dangerous.
+ print(f'WRITING{cwd}---{filename} ')
with open(filepath, "w") as f:
- print(f'WRITING{cwd}---{filename} ')
f.write(filecontent)
- #filepath.chmod(0o664) # set file permissions to rw-rw-r--
- os.chmod(filepath, 0o664) # set file permissions to rw-rw-r--
+ #os.chmod(filepath, 0o664) # set file permissions to rw-rw-r--
+ # should replace .call with .run and capture_output=True
call([git, "add", filename], cwd=cwd)
call([git, "commit", "-m", 'Online cave or entrance edit'], cwd=cwd)