Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Leap:15.2:Update
python-django-babel
django21.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File django21.patch of Package python-django-babel
From 051e0f87afbb5143734c3b3500943d3a5e5e7881 Mon Sep 17 00:00:00 2001 From: Ivan Tsouvarev <tsouvarev@gmail.com> Date: Fri, 7 Sep 2018 19:24:14 +0300 Subject: [PATCH] Fix imports of token types for Django 2.1 --- django_babel/extract.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/django_babel/extract.py b/django_babel/extract.py index edb42c7..2b28ce6 100644 --- a/django_babel/extract.py +++ b/django_babel/extract.py @@ -1,5 +1,20 @@ # -*- 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: + try: + # Django 1.8 moved most stuff to .base + 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
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor