From 24b5f469a241a71d39229228117df309fd482139 Mon Sep 17 00:00:00 2001 From: Bill Amberg Date: Tue, 22 Jun 2021 09:06:53 -0400 Subject: [PATCH 1/4] Add failing test environment for Django==3.2 --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index ae6d32e..41a9665 100644 --- a/tox.ini +++ b/tox.ini @@ -35,6 +35,7 @@ deps = dj22: Django<2.3 dj30: Django<3.1 dj31: Django<3.2 + dj32: Django<3.3 djmain: https://github.com/django/django/archive/main.tar.gz#egg=django commands = From f45cd228f94c9653e198d3ccd99b87a73e66071e Mon Sep 17 00:00:00 2001 From: Bill Amberg Date: Tue, 22 Jun 2021 09:40:53 -0400 Subject: [PATCH 2/4] Get cache for Django>=3.2 --- dbtemplates/utils/cache.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dbtemplates/utils/cache.py b/dbtemplates/utils/cache.py index 98f63f7..53f0078 100644 --- a/dbtemplates/utils/cache.py +++ b/dbtemplates/utils/cache.py @@ -1,3 +1,4 @@ +import django from django.core import signals from django.contrib.sites.models import Site from django.template.defaultfilters import slugify @@ -9,8 +10,12 @@ def get_cache_backend(): """ Compatibilty wrapper for getting Django's cache backend instance """ - from django.core.cache import _create_cache - cache = _create_cache(settings.DBTEMPLATES_CACHE_BACKEND) + if django.VERSION[0] >= 3 and django.VERSION[1] >= 2: + from django.core.cache import caches + cache = caches.create_connection(settings.DBTEMPLATES_CACHE_BACKEND) + else: + from django.core.cache import _create_cache + cache = _create_cache(settings.DBTEMPLATES_CACHE_BACKEND) # Some caches -- python-memcached in particular -- need to do a cleanup at # the end of a request cycle. If not implemented in a particular backend # cache.close is a no-op From 8cd8a17bc1d127c9812ae558cf0b658a13f65fd6 Mon Sep 17 00:00:00 2001 From: Bill Amberg Date: Tue, 22 Jun 2021 09:41:33 -0400 Subject: [PATCH 3/4] Use strings explicitly for template directories --- dbtemplates/management/commands/sync_templates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbtemplates/management/commands/sync_templates.py b/dbtemplates/management/commands/sync_templates.py index 269cc15..7d95429 100644 --- a/dbtemplates/management/commands/sync_templates.py +++ b/dbtemplates/management/commands/sync_templates.py @@ -65,7 +65,7 @@ class Command(BaseCommand): tpl_dirs = app_template_dirs + DIRS else: tpl_dirs = DIRS + app_template_dirs - templatedirs = [d for d in tpl_dirs if os.path.isdir(d)] + templatedirs = [str(d) for d in tpl_dirs if os.path.isdir(d)] for templatedir in templatedirs: for dirpath, subdirs, filenames in os.walk(templatedir): From 376f33916fc73a5f80b65a93b443b54fd32cf190 Mon Sep 17 00:00:00 2001 From: Nikolaus Schlemm Date: Thu, 8 Jul 2021 10:18:39 +0200 Subject: [PATCH 4/4] focus on currently supported releases of python and django --- tox.ini | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tox.ini b/tox.ini index 41a9665..6c37e0f 100644 --- a/tox.ini +++ b/tox.ini @@ -4,14 +4,11 @@ usedevelop = True minversion = 1.8 envlist = flake8 - py{35,36}-dj111 - py{35,36,37}-dj21 - py{35,36,37,38,39}-dj22 - py{36,37,38,39}-dj{30,31} + py3{6,7,8,9}-dj22 + py3{6,7,8,9}-dj32 [gh-actions] python = - 3.5: py36 3.6: py36 3.7: py37 3.8: py38, flake8 @@ -19,7 +16,6 @@ python = [testenv] basepython = - py35: python3.5 py36: python3.6 py37: python3.7 py38: python3.8 @@ -29,12 +25,7 @@ setenv = DJANGO_SETTINGS_MODULE = dbtemplates.test_settings deps = -r requirements/tests.txt - dj111: Django<2.0 - dj20: Django<2.1 - dj21: Django<2.2 dj22: Django<2.3 - dj30: Django<3.1 - dj31: Django<3.2 dj32: Django<3.3 djmain: https://github.com/django/django/archive/main.tar.gz#egg=django @@ -45,7 +36,7 @@ commands = coverage xml [testenv:flake8] -basepython = python3.8 +basepython = python3.9 commands = flake8 dbtemplates deps = flake8