Skip to content

Commit

Permalink
Switch back to hooking in to hashed_name method
Browse files Browse the repository at this point in the history
The previous approach caused the bug which resulted in deleting the
manifest file.
  • Loading branch information
evansd committed Jul 7, 2018
1 parent 52eccef commit 9e02fa5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions whitenoise/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def post_process_with_compression(self, files):
# Files may get hashed multiple times, we want to keep track of all the
# intermediate files generated during the process and which of these
# are the final names used for each file. As not every intermediate
# file is yielded we have to hook in to the `_save` method to
# file is yielded we have to hook in to the `hashed_name` method to
# keep track of them all.
hashed_names = {}
new_files = set()
Expand All @@ -51,9 +51,9 @@ def post_process_with_compression(self, files):
for name, compressed_name in self.compress_files(files_to_compress):
yield name, compressed_name, True

def _save(self, *args, **kwargs):
name = super(CompressedStaticFilesMixin, self)._save(*args, **kwargs)
if self._new_files is not None and name is not None:
def hashed_name(self, *args, **kwargs):
name = super(CompressedStaticFilesMixin, self).hashed_name(*args, **kwargs)
if self._new_files is not None:
self._new_files.add(self.clean_name(name))
return name

Expand Down

0 comments on commit 9e02fa5

Please sign in to comment.