From d39b9eea7ce75badf9dee72df4c19eca9d895c53 Mon Sep 17 00:00:00 2001 From: Artyom Vancyan Date: Thu, 24 Jul 2025 13:42:21 +0400 Subject: [PATCH 1/7] GH-39: Accept empty "HTTP Accept" header --- src/django_forbid/middleware.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/django_forbid/middleware.py b/src/django_forbid/middleware.py index 5946874..f9134b8 100644 --- a/src/django_forbid/middleware.py +++ b/src/django_forbid/middleware.py @@ -20,7 +20,8 @@ def __init__(self, get_response): def __call__(self, request): get_response = self.get_response - if self.regex.search(request.META.get("HTTP_ACCEPT")): + http_accept = request.META.get("HTTP_ACCEPT") + if isinstance(http_accept, (bytes, str)) and self.regex.search(http_accept): for skill in __skills__: get_response = skill(get_response) return get_response(request) From fd02aeab3bc0d545dc286aff4f241114bb16c349 Mon Sep 17 00:00:00 2001 From: Artyom Vancyan Date: Sat, 26 Jul 2025 13:55:04 +0400 Subject: [PATCH 2/7] Fix the wheel path resolvation issue --- build.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.sh b/build.sh index b7ad47e..d2c24ae 100644 --- a/build.sh +++ b/build.sh @@ -4,5 +4,4 @@ pip install build==0.9.0 # build the wheel and install it -WHEEL_NAME=$(python -m build | grep -Po "django_forbid-.*\.whl" | tail -n 1) -pip install dist/$WHEEL_NAME \ No newline at end of file +python -m build && pip install $(ls dist/django_forbid-*.whl) \ No newline at end of file From 6859c39f3059a77a848304b1b2742717b77a1846 Mon Sep 17 00:00:00 2001 From: Artyom Vancyan Date: Sat, 26 Jul 2025 14:16:30 +0400 Subject: [PATCH 3/7] Update the PyPI classifiers --- setup.cfg | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 6250003..b76147e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -38,13 +38,15 @@ classifiers = Framework :: Django :: 3.2 Framework :: Django :: 4.1 Framework :: Django :: 4.2 + Framework :: Django :: 5.1 + Framework :: Django :: 5.2 Programming Language :: Python Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 License :: OSI Approved :: MIT License [options] @@ -56,7 +58,7 @@ install_requires = geoip2 device_detector include_package_data = yes -python_requires = >=3.6 +python_requires = >=3.7 package_dir = =src zip_safe = no From 81a864a13225ef54a01520fb160c06ad02295ae1 Mon Sep 17 00:00:00 2001 From: Artyom Vancyan Date: Sat, 26 Jul 2025 14:17:09 +0400 Subject: [PATCH 4/7] Drop py36 support and add Django 5.x support --- .github/workflows/tests.yml | 26 +++++++++++++++++++------- tox.ini | 9 +++++---- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a204852..839ce0c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,23 +8,21 @@ on: jobs: test: - runs-on: ${{ matrix.os || 'ubuntu-latest' }} + runs-on: ubuntu-latest strategy: matrix: include: - - python: "3.6" - env: py36-django21 - os: ubuntu-20.04 # 3.6 is not available on ubuntu-20.04 + - python: "3.7" + env: py37-django21 - python: "3.8" env: py38-django21 - python: "3.9" env: py39-django21 - - python: "3.6" - env: py36-django32 - os: ubuntu-20.04 # 3.6 is not available on ubuntu-20.04 - python: "3.8" env: py38-django32 + - python: "3.9" + env: py39-django32 - python: "3.10" env: py310-django32 @@ -49,6 +47,20 @@ jobs: - python: "3.11" env: py311-django42 + - python: "3.9" + env: py39-django51 + - python: "3.10" + env: py310-django51 + - python: "3.11" + env: py311-django51 + + - python: "3.9" + env: py39-django52 + - python: "3.10" + env: py310-django52 + - python: "3.11" + env: py311-django52 + steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python }} diff --git a/tox.ini b/tox.ini index 05daa81..9875bc9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,14 +1,15 @@ [tox] envlist = - py{36,38,39}-django21 - py{36,38,310}-django32 + py{37,38,39}-django21 + py{38,39,310}-django32 py{38,39,310}-django40 py{39,310,311}-django{41,42} - py{310,311}-djangomain + py{39,310,311}-django{51,52} [testenv] deps = - djangomain: https://github.com/django/django/tarball/main + django52: django>=5.2 + django51: django<5.2 django42: django<4.3 django41: django<4.2 django40: django<4.1 From 62f46a775d20952071639f403c8465e4eafa7b12 Mon Sep 17 00:00:00 2001 From: Artyom Vancyan Date: Sat, 26 Jul 2025 14:19:04 +0400 Subject: [PATCH 5/7] Remove py37 check as GitHub cannot identify it --- .github/workflows/tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 839ce0c..031bb23 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,8 +12,6 @@ jobs: strategy: matrix: include: - - python: "3.7" - env: py37-django21 - python: "3.8" env: py38-django21 - python: "3.9" From 096cb8e165898b7b4780f13e6e9047e2cd84a5f4 Mon Sep 17 00:00:00 2001 From: Artyom Vancyan Date: Sat, 26 Jul 2025 14:25:11 +0400 Subject: [PATCH 6/7] Add support for py312 --- .github/workflows/tests.yml | 4 ++-- setup.cfg | 1 + tox.ini | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 031bb23..27f53d3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,12 +52,12 @@ jobs: - python: "3.11" env: py311-django51 - - python: "3.9" - env: py39-django52 - python: "3.10" env: py310-django52 - python: "3.11" env: py311-django52 + - python: "3.12" + env: py312-django52 steps: - uses: actions/checkout@v2 diff --git a/setup.cfg b/setup.cfg index b76147e..84348e6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -47,6 +47,7 @@ classifiers = Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 License :: OSI Approved :: MIT License [options] diff --git a/tox.ini b/tox.ini index 9875bc9..b9b096f 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ envlist = py{38,39,310}-django32 py{38,39,310}-django40 py{39,310,311}-django{41,42} - py{39,310,311}-django{51,52} + py{310,311,312}-django{51,52} [testenv] deps = From ee07b10e8e980dc61238e87325e3f76d61bd6a3f Mon Sep 17 00:00:00 2001 From: Artyom Vancyan Date: Sat, 26 Jul 2025 14:26:09 +0400 Subject: [PATCH 7/7] Fix the python version for django51 --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 27f53d3..39802c8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,12 +45,12 @@ jobs: - python: "3.11" env: py311-django42 - - python: "3.9" - env: py39-django51 - python: "3.10" env: py310-django51 - python: "3.11" env: py311-django51 + - python: "3.12" + env: py312-django51 - python: "3.10" env: py310-django52