Skip to content

Commit 30a5966

Browse files
committed
Remove Django<1.8 compatibility safeguards
1 parent 88b3893 commit 30a5966

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

django_babel/extract.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,11 @@
11
# -*- coding: utf-8 -*-
2-
try:
3-
from django.template import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK
4-
except ImportError:
5-
# Django 1.8 moved most stuff to .base
6-
from django.template.base import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK
7-
8-
try:
9-
from django.utils.translation import trim_whitespace as trim_django
10-
except ImportError:
11-
trim_django = False
12-
2+
from django.template.base import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK
3+
from django.utils.translation import trim_whitespace
134
from django.utils.encoding import smart_text
145
from django.utils.translation.trans_real import (
156
inline_re, block_re, endblock_re, plural_re, constant_re)
167

178

18-
def trim_whitespace(string):
19-
"""Trim whitespace.
20-
21-
This is only supported in Django>=1.7. This method help in cases of older
22-
Django versions.
23-
"""
24-
if trim_django:
25-
return trim_django(string)
26-
return string
27-
28-
299
def join_tokens(tokens, trim=False):
3010
message = ''.join(tokens)
3111
if trim:

django_babel/middleware.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
from babel import Locale, UnknownLocaleError
44
from django.utils.translation import get_language
5-
try:
6-
from threading import local
7-
except ImportError:
8-
from django.utils._threading_local import local
5+
from threading import local
96

107

118
__all__ = ['get_current_locale', 'LocaleMiddleware']

0 commit comments

Comments
 (0)