| 49 | return datetime.fromtimestamp(os.path.getmtime(self.path(name))) |
| 50 | |
| 51 | def save(self, filename, content): |
| 52 | temp_filename = super().save(filename, content) |
| 53 | # If a file already exists in the target location, FileSystemStorage |
| 54 | # will generate an unique filename and save content there instead. |
| 55 | # When that happens, we move the file to the intended location using |
| 56 | # os.replace() (which is an atomic operation): |
| 57 | if temp_filename != filename: |
| 58 | os.replace(self.path(temp_filename), self.path(filename)) |
| 59 | |
| 60 | return filename |
| 61 | |
| 62 | |
| 63 | compressor_file_storage = SimpleLazyObject( |