From b359937eabd383351e8863d80c785f05da029ab4 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Thu, 30 Dec 2021 21:13:34 +0000 Subject: remove chmod attempt --- core/models/caves.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'core/models/caves.py') 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) -- cgit v1.2.3