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.

This commit is contained in:
Jannis Leidel 2012-05-16 13:21:46 +02:00
parent 085c03e08b
commit 5f75ac91df
4 changed files with 71 additions and 8 deletions

View file

@ -348,6 +348,15 @@ CachedStaticFilesStorage
:setting:`CACHES` setting named ``'staticfiles'``. It falls back to using
the ``'default'`` cache backend.
.. method:: file_hash(name, content=None)
.. versionadded:: 1.5
The method that is used when creating the hashed name of a file.
Needs to return a hash for the given file name and content.
By default it calculates a MD5 hash from the content's chunks as
mentioned above.
.. _`far future Expires headers`: http://developer.yahoo.com/performance/rules.html#expires
.. _`@import`: http://www.w3.org/TR/CSS2/cascade.html#at-import
.. _`url()`: http://www.w3.org/TR/CSS2/syndata.html#uri