Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,19 @@ 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.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

Expand All @@ -49,6 +45,20 @@ jobs:
- python: "3.11"
env: py311-django42

- python: "3.10"
env: py310-django51
- python: "3.11"
env: py311-django51
- python: "3.12"
env: py312-django51

- python: "3.10"
env: py310-django52
- python: "3.11"
env: py311-django52
- python: "3.12"
env: py312-django52

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
Expand Down
3 changes: 1 addition & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
python -m build && pip install $(ls dist/django_forbid-*.whl)
7 changes: 5 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ 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
Programming Language :: Python :: 3.12
License :: OSI Approved :: MIT License

[options]
Expand All @@ -56,7 +59,7 @@ install_requires =
geoip2
device_detector
include_package_data = yes
python_requires = >=3.6
python_requires = >=3.7
package_dir =
=src
zip_safe = no
3 changes: 2 additions & 1 deletion src/django_forbid/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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{310,311,312}-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
Expand Down