diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8bb11da..c5f45a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,8 +10,8 @@ jobs: fail-fast: false max-parallel: 5 matrix: - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] - django-version: ['2.2', '3.2'] + python-version: ['3.8', '3.9', '3.10', '3.11'] + django-version: ['3.2', '4.1'] steps: - uses: actions/checkout@v2 @@ -41,4 +41,4 @@ jobs: run: | tox -v env: - DJANGO: ${{ matrix.django-version }} \ No newline at end of file + DJANGO: ${{ matrix.django-version }} diff --git a/ChangeLog.rst b/ChangeLog.rst index 6f4a985..a18028b 100644 --- a/ChangeLog.rst +++ b/ChangeLog.rst @@ -5,6 +5,10 @@ ChangeLog Release 0.42 (Unreleased) ========================== +- Support Django-4.1 +- Support Python-3.8, 3.9, 3.10, 3.11 +- Drop Django-2.2 +- Drop Python-3.6, 3.7 Release 0.41 (2022-01-25) diff --git a/beproud/django/commons/templatetags/string_tags.py b/beproud/django/commons/templatetags/string_tags.py index e778346..13aba13 100644 --- a/beproud/django/commons/templatetags/string_tags.py +++ b/beproud/django/commons/templatetags/string_tags.py @@ -3,7 +3,7 @@ from django import template from django.template.defaultfilters import stringfilter -from django.utils.encoding import force_text +from django.utils.encoding import force_str from .compat import abbrev as abbrev_ @@ -18,7 +18,7 @@ def cat(value, arg): """ Concatenates value with argument """ - return u"%s%s" % (value, force_text(arg)) + return u"%s%s" % (value, force_str(arg)) cat.is_safe=True cat = stringfilter(cat) register.filter(cat) diff --git a/beproud/django/commons/views/simple.py b/beproud/django/commons/views/simple.py index 49039ac..bc0e280 100644 --- a/beproud/django/commons/views/simple.py +++ b/beproud/django/commons/views/simple.py @@ -1,11 +1,11 @@ # vim:fileencoding=utf-8 import re +from urllib.parse import quote from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone from django.conf import settings from django.template.loader import render_to_string -from django.utils.http import urlquote __all__ = ( 'redirect_to', @@ -26,10 +26,10 @@ def redirect_to(request, url, permanent=True, **kwargs): klass = permanent and HttpResponsePermanentRedirect or HttpResponseRedirect quoted_kwargs = {} for k,v in kwargs.items(): - quoted_kwargs[k] = urlquote(v) + quoted_kwargs[k] = quote(v, "/") # Encoded urls confuses python templating. Properly escape the templates. - return klass(urlquote(RE_QUOTE.sub(r"%%\1", url) % quoted_kwargs)) + return klass(quote(RE_QUOTE.sub(r"%%\1", url) % quoted_kwargs), "/") else: return HttpResponseGone() diff --git a/tests/settings.py b/tests/settings.py index 68d327d..b672f48 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -24,3 +24,4 @@ 'BACKEND': 'django.template.backends.django.DjangoTemplates', }] SECRET_KEY = '' +USE_TZ = False diff --git a/tox.ini b/tox.ini index c493270..8d8e2b3 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ [tox] envlist = - py{36,37,38,39,310}-dj{22,32} + py{38,39,310,311}-dj{32,41} [testenv] deps = @@ -13,18 +13,18 @@ deps = mock dj22: Django>=2.2,<3.0 dj32: Django>=3.2,<4.0 + dj41: Django>=4.1,<4.2 commands=pytest tests {posargs} [gh-actions] python = - 3.6: py36 - 3.7: py37 3.8: py38 3.9: py39 3.10: py310 + 3.11: py311 [gh-actions:env] DJANGO = - 2.2: dj22 3.2: dj32 + 4.1: dj41