Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #17896 -- Added file_hash method to CachedStaticFilesStorage to…
… be able to customize the way the hashed name of a file is created. Thanks to mkai for the initial patch.
- Loading branch information
Showing
4 changed files
with
71 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5f75ac9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jezdez What do you think about removing the
content
arg fromfile_hash()
and moving the file reading into it? That way, you would be able to get rid of the potential network operations ofexists()
andopen()
just by overridingfile_hash()
. (I believe the original reason behind this patch was to avoid network operations, but it seems that—with thoseexists()
andopen()
calls still present inhashed_name()
—it hasn't quite gone far enough.)As an example of why this would be rad, I'm thinking of a
CachedStaticFilesStorage
that overridesfile_hash()
and uses the local static files to compute the hash, instead of reading over the network, a laCachedFilesMixin.post_process()
.