Bug 1483051 - Update to whitenoise 4

* Renames `is_immutable_file` to match changes to the parent class.
* Suppresses the new "missing static files directory" warning when
  running the tests (since it's expected in !production).
* Uses the new `extras_require` `[brotli]` entry to make WhiteNoise's
  dependency more obvious.

Changelog:
http://whitenoise.evans.io/en/stable/changelog.html#v4-0

Closes #3903.
This commit is contained in:
Ed Morley 2018-08-14 00:03:23 +01:00
Родитель a795883740
Коммит 67d09d55d8
3 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -4,11 +4,11 @@ gunicorn==19.8.1 \
--hash=sha256:7ef2b828b335ed58e3b64ffa84caceb0a7dd7c5ca12f217241350dec36a1d5dc \
--hash=sha256:bc59005979efb6d2dd7d5ba72d99f8a8422862ad17ff3a16e900684630dd2a10
whitenoise==3.3.1 \
--hash=sha256:15f43b2e701821b95c9016cf469d29e2a546cb1c7dead584ba82c36f843995cf \
--hash=sha256:9d81515f2b5b27051910996e1e860b1332e354d9e7bcf30c98f21dcb6713e0dd
whitenoise[brotli]==4.0 \
--hash=sha256:a6f86b011675b9730f69fd69d4f54c5697d6c7a90ab06f83f784d243d9fccc02 \
--hash=sha256:1e206c5adfb849942ddd057e599ac472ec1a85d56ae78a5ba24f243ea46a89c5
# Used by the Whitenoise CLI tool to provide Brotli-compressed versions of static files.
# Used by Whitenoise to provide Brotli-compressed versions of static files.
Brotli==1.0.4 \
--hash=sha256:801ed45374e79643a6fa22df3fa15f9b1b511ac0b7ec4bd3889a2893aeb75110 \
--hash=sha256:ea80498d48a11aeaf2dda058e1d0082176bab5351fc17e3718c5320094f9bfe5 \

Просмотреть файл

@ -44,6 +44,10 @@ filterwarnings =
error
ignore::ImportWarning
ignore::PendingDeprecationWarning
# WhiteNoise warns if either `treeherder/static/` or `dist/` do not exist at startup,
# however this is expected when running tests since Django collectstatic and yarn build
# (which create those directories) typically aren't run apart from during deployments.
ignore:No directory at.*:UserWarning:whitenoise.base
# `python2 -3` mode warning that's a real bug. Remove once bug 1453837 is fixed.
ignore:comparing unequal types not supported in 3.x:DeprecationWarning:treeherder.auth.backends
# Hide `python2 -3` mode warnings that are false positives

Просмотреть файл

@ -43,14 +43,14 @@ class CustomWhiteNoise(WhiteNoiseMiddleware):
url += self.INDEX_NAME
return super(CustomWhiteNoise, self).find_file(url)
def is_immutable_file(self, path, url):
def immutable_file_test(self, path, url):
"""Support webpack bundle filenames when setting long max-age headers."""
if self.IMMUTABLE_FILE_RE.search(url):
return True
# Otherwise fall back to the default method, so we catch filenames in the
# style output by GzipManifestStaticFilesStorage during collectstatic. eg:
# bootstrap.min.abda843684d0.js
return super(CustomWhiteNoise, self).is_immutable_file(path, url)
return super(CustomWhiteNoise, self).immutable_file_test(path, url)
class NewRelicMiddleware(MiddlewareMixin):