MCPcopy Create free account
hub / github.com/django-compressor/django-compressor / save

Method save

compressor/storage.py:51–60  ·  view source on GitHub ↗
(self, filename, content)

Source from the content-addressed store, hash-verified

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
63compressor_file_storage = SimpleLazyObject(

Callers 8

saveMethod · 0.45
saveMethod · 0.45
write_offline_manifestFunction · 0.45
output_fileMethod · 0.45
test_gzip_storageMethod · 0.45
test_brotli_storageMethod · 0.45

Calls 2

replaceMethod · 0.80
pathMethod · 0.80