From 996e89637a26aca68d6476f5b35520f011a8840e Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Mon, 13 May 2024 16:23:07 -0700 Subject: [PATCH] Upgrade whitenoise dependency. --- kolibri/utils/kolibri_whitenoise.py | 6 ++---- requirements/base.txt | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/kolibri/utils/kolibri_whitenoise.py b/kolibri/utils/kolibri_whitenoise.py index 18d39bc9da0..8f342d11d8f 100644 --- a/kolibri/utils/kolibri_whitenoise.py +++ b/kolibri/utils/kolibri_whitenoise.py @@ -2,6 +2,7 @@ import re import stat from collections import OrderedDict +from http import HTTPStatus from io import BufferedIOBase from urllib.parse import parse_qs from urllib.parse import urljoin @@ -12,7 +13,6 @@ from django.core.files.storage import FileSystemStorage from django.utils._os import safe_join from whitenoise import WhiteNoise -from whitenoise.httpstatus_backport import HTTPStatus from whitenoise.responders import MissingFileError from whitenoise.responders import NOT_ALLOWED_RESPONSE from whitenoise.responders import Response @@ -25,8 +25,6 @@ compressed_file_extensions = ("gz",) -not_found_status = HTTPStatus(404, "Not Found") - class NotFoundStaticFile(object): """ @@ -35,7 +33,7 @@ class NotFoundStaticFile(object): """ def get_response(self, method, request_headers): - return Response(not_found_status, [], None) + return Response(status=HTTPStatus.NOT_FOUND, headers=[], file=None) NOT_FOUND = NotFoundStaticFile() diff --git a/requirements/base.txt b/requirements/base.txt index bb1c71ab0e0..3f052fb078c 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -22,7 +22,7 @@ redis==3.2.1 html5lib==1.1 zeroconf-py2compat==0.19.17 Click==7.0 -whitenoise==4.1.4 +whitenoise==5.3.0 idna==3.7 ifaddr==0.1.7 # Pin as version 0.2.0 only supports Python 3.7 and above importlib-metadata==2.1.1