Skip to content

Commit 4cef96a

Browse files
GH-39: Accept empty "HTTP Accept" header (GH-40)
2 parents 9bbc8f6 + ee07b10 commit 4cef96a

File tree

5 files changed

+30
-16
lines changed

5 files changed

+30
-16
lines changed

.github/workflows/tests.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,19 @@ on:
88

99
jobs:
1010
test:
11-
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
11+
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
1414
include:
15-
- python: "3.6"
16-
env: py36-django21
17-
os: ubuntu-20.04 # 3.6 is not available on ubuntu-20.04
1815
- python: "3.8"
1916
env: py38-django21
2017
- python: "3.9"
2118
env: py39-django21
2219

23-
- python: "3.6"
24-
env: py36-django32
25-
os: ubuntu-20.04 # 3.6 is not available on ubuntu-20.04
2620
- python: "3.8"
2721
env: py38-django32
22+
- python: "3.9"
23+
env: py39-django32
2824
- python: "3.10"
2925
env: py310-django32
3026

@@ -49,6 +45,20 @@ jobs:
4945
- python: "3.11"
5046
env: py311-django42
5147

48+
- python: "3.10"
49+
env: py310-django51
50+
- python: "3.11"
51+
env: py311-django51
52+
- python: "3.12"
53+
env: py312-django51
54+
55+
- python: "3.10"
56+
env: py310-django52
57+
- python: "3.11"
58+
env: py311-django52
59+
- python: "3.12"
60+
env: py312-django52
61+
5262
steps:
5363
- uses: actions/checkout@v2
5464
- name: Set up Python ${{ matrix.python }}

build.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
pip install build==0.9.0
55

66
# build the wheel and install it
7-
WHEEL_NAME=$(python -m build | grep -Po "django_forbid-.*\.whl" | tail -n 1)
8-
pip install dist/$WHEEL_NAME
7+
python -m build && pip install $(ls dist/django_forbid-*.whl)

setup.cfg

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,16 @@ classifiers =
3838
Framework :: Django :: 3.2
3939
Framework :: Django :: 4.1
4040
Framework :: Django :: 4.2
41+
Framework :: Django :: 5.1
42+
Framework :: Django :: 5.2
4143
Programming Language :: Python
4244
Programming Language :: Python :: 3
43-
Programming Language :: Python :: 3.6
4445
Programming Language :: Python :: 3.7
4546
Programming Language :: Python :: 3.8
4647
Programming Language :: Python :: 3.9
4748
Programming Language :: Python :: 3.10
49+
Programming Language :: Python :: 3.11
50+
Programming Language :: Python :: 3.12
4851
License :: OSI Approved :: MIT License
4952

5053
[options]
@@ -56,7 +59,7 @@ install_requires =
5659
geoip2
5760
device_detector
5861
include_package_data = yes
59-
python_requires = >=3.6
62+
python_requires = >=3.7
6063
package_dir =
6164
=src
6265
zip_safe = no

src/django_forbid/middleware.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def __init__(self, get_response):
2020

2121
def __call__(self, request):
2222
get_response = self.get_response
23-
if self.regex.search(request.META.get("HTTP_ACCEPT")):
23+
http_accept = request.META.get("HTTP_ACCEPT")
24+
if isinstance(http_accept, (bytes, str)) and self.regex.search(http_accept):
2425
for skill in __skills__:
2526
get_response = skill(get_response)
2627
return get_response(request)

tox.ini

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
[tox]
22
envlist =
3-
py{36,38,39}-django21
4-
py{36,38,310}-django32
3+
py{37,38,39}-django21
4+
py{38,39,310}-django32
55
py{38,39,310}-django40
66
py{39,310,311}-django{41,42}
7-
py{310,311}-djangomain
7+
py{310,311,312}-django{51,52}
88

99
[testenv]
1010
deps =
11-
djangomain: https://github.com/django/django/tarball/main
11+
django52: django>=5.2
12+
django51: django<5.2
1213
django42: django<4.3
1314
django41: django<4.2
1415
django40: django<4.1

0 commit comments

Comments
 (0)