summaryrefslogtreecommitdiffstats
path: root/core/models/caves.py
diff options
context:
space:
mode:
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)