diff options
Diffstat (limited to 'core/utils.py')
-rw-r--r-- | core/utils.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/utils.py b/core/utils.py index 0e0dfcc..7111c0c 100644 --- a/core/utils.py +++ b/core/utils.py @@ -152,6 +152,8 @@ def write_and_commit(files, message): # GIT see also core/views/uploads.py dwgupload() # GIT see also core/views/expo.py editexpopage() os.makedirs(os.path.dirname(filepath), exist_ok = True) + if filepath.is_dir(): + return False if encoding: mode = "w" kwargs = {"encoding": encoding} @@ -160,7 +162,7 @@ def write_and_commit(files, message): kwargs = {} try: with open(filepath, mode, **kwargs) as f: - print(f"WRITING {cwd}---{filename} ") + print(f"WRITING {cwd}/{filename} ") f.write(content) except PermissionError: raise WriteAndCommitError( @@ -226,6 +228,7 @@ def write_and_commit(files, message): raise WriteAndCommitError( f"CANNOT git on server for this file {filename}. Subprocess error. Edits not saved.\nAsk a nerd to fix this." ) + return True class WriteAndCommitError(Exception): |