From edf593cbfbdc6e2568b7fa54923a8b7e66d70dbb Mon Sep 17 00:00:00 2001 From: Ivan Tsouvarev Date: Fri, 7 Sep 2018 19:24:14 +0300 Subject: [PATCH 1/5] Fix imports of token types for Django 2.1 --- django_babel/extract.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/django_babel/extract.py b/django_babel/extract.py index edb42c7..e664a16 100644 --- a/django_babel/extract.py +++ b/django_babel/extract.py @@ -1,5 +1,14 @@ # -*- coding: utf-8 -*- -from django.template.base import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK +try: + from django.template.base import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK +except ImportError: + # Django 2.1+ + from django.template.base import Lexer, TokenType + + TOKEN_TEXT = TokenType.TEXT + TOKEN_VAR = TokenType.VAR + TOKEN_BLOCK = TokenType.BLOCK + from django.utils.translation import trim_whitespace from django.utils.encoding import smart_text From a935848e388f1619e2302d6bc8549c5b8546573a Mon Sep 17 00:00:00 2001 From: Ivan Tsouvarev Date: Fri, 7 Sep 2018 20:44:09 +0300 Subject: [PATCH 2/5] Update tox matrix --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index e763d02..1fe3de5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{35,36}-djangomaster, py{27,34,35,36}-django{18,111,20}, lint, docs +envlist = py{35,36,37}-django{21,master}, py{27,34,35,36}-django{18,111,20}, lint, docs [testenv] deps = @@ -11,6 +11,7 @@ deps = django18: Django>=1.8,<1.9 django111: Django>=1.11,<2.0 django20: Django>=2.0,<2.1 + django21: Django>=2.1,<2.2 djangomaster: https://github.com/django/django/archive/master.tar.gz#egg=Django commands = py.test {posargs} From 404a8f969ed0b239e58d7efad2e420d05dedb5fb Mon Sep 17 00:00:00 2001 From: Ivan Tsouvarev Date: Fri, 7 Sep 2018 19:24:14 +0300 Subject: [PATCH 3/5] Fix imports of token types for Django 2.1 --- django_babel/extract.py | 11 ++++++++++- tox.ini | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/django_babel/extract.py b/django_babel/extract.py index edb42c7..e664a16 100644 --- a/django_babel/extract.py +++ b/django_babel/extract.py @@ -1,5 +1,14 @@ # -*- coding: utf-8 -*- -from django.template.base import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK +try: + from django.template.base import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK +except ImportError: + # Django 2.1+ + from django.template.base import Lexer, TokenType + + TOKEN_TEXT = TokenType.TEXT + TOKEN_VAR = TokenType.VAR + TOKEN_BLOCK = TokenType.BLOCK + from django.utils.translation import trim_whitespace from django.utils.encoding import smart_text diff --git a/tox.ini b/tox.ini index e763d02..1fe3de5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{35,36}-djangomaster, py{27,34,35,36}-django{18,111,20}, lint, docs +envlist = py{35,36,37}-django{21,master}, py{27,34,35,36}-django{18,111,20}, lint, docs [testenv] deps = @@ -11,6 +11,7 @@ deps = django18: Django>=1.8,<1.9 django111: Django>=1.11,<2.0 django20: Django>=2.0,<2.1 + django21: Django>=2.1,<2.2 djangomaster: https://github.com/django/django/archive/master.tar.gz#egg=Django commands = py.test {posargs} From 44a59e717d9000ae0823b46f2d63c0c1f0157452 Mon Sep 17 00:00:00 2001 From: Fabre Florian Date: Fri, 8 Mar 2019 16:21:02 +0100 Subject: [PATCH 4/5] Confirm compatibility for Django 2.2 & Update changelogs --- .travis.yml | 7 ++++++- CHANGELOG.rst | 5 +++-- tox.ini | 6 +++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3ff110a..cc48347 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,8 @@ env: - TOX_ENV=py35-django18 - TOX_ENV=py35-django111 - TOX_ENV=py35-django20 - - TOX_ENV=py35-djangomaster + - TOX_ENV=py35-django21 + - TOX_ENV=py35-django22 matrix: include: - env: TOX_ENV=py36-django18 @@ -21,6 +22,10 @@ matrix: python: "3.6" - env: TOX_ENV=py36-django20 python: "3.6" + - env: TOX_ENV=py36-django21 + python: "3.6" + - env: TOX_ENV=py36-django22 + python: "3.6" - env: TOX_ENV=py36-djangomaster python: "3.6" install: pip install tox diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 068a482..ddca4c3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,8 +4,9 @@ Changelog 0.6.3 (unreleased) ------------------ -- Nothing changed yet. - +- Confirm compatibility with Django 2.2 +- Compatibility with Django 2.1 added. + From @tsouvarev work : https://github.com/python-babel/django-babel/pull/45 0.6.2 (2017-12-18) ------------------ diff --git a/tox.ini b/tox.ini index 1fe3de5..f31b7d9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,8 @@ [tox] -envlist = py{35,36,37}-django{21,master}, py{27,34,35,36}-django{18,111,20}, lint, docs +envlist = py{27,34,35,36}-django{18,111}, + py{35,36,37}-django{20,21,22}, + py{36,37}-django{master}, + lint, docs [testenv] deps = @@ -12,6 +15,7 @@ deps = django111: Django>=1.11,<2.0 django20: Django>=2.0,<2.1 django21: Django>=2.1,<2.2 + django22: Django>=2.2,<3 djangomaster: https://github.com/django/django/archive/master.tar.gz#egg=Django commands = py.test {posargs} From dbc113798aa4beabdfa2d00e6fef48248eb0f185 Mon Sep 17 00:00:00 2001 From: Christopher Grebs Date: Tue, 7 May 2019 14:19:05 +0200 Subject: [PATCH 5/5] Small cleanup based on #45 --- django_babel/extract.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/django_babel/extract.py b/django_babel/extract.py index e664a16..d3a82f9 100644 --- a/django_babel/extract.py +++ b/django_babel/extract.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- +from django.template.base import Lexer try: - from django.template.base import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK -except ImportError: - # Django 2.1+ - from django.template.base import Lexer, TokenType - + from django.template.base import TokenType +except ImportError: # django < 2.1 + from django.template.base import TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK +else: TOKEN_TEXT = TokenType.TEXT TOKEN_VAR = TokenType.VAR TOKEN_BLOCK = TokenType.BLOCK