Skip to content

Commit 47123c0

Browse files
author
Thomas Grainger
committed
regular python imports
1 parent a78059c commit 47123c0

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

django_babel/templatetags/babel.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# -*- coding: utf-8 -*-
22

3+
from babel import support as babel_support
4+
from babel import core as babel_core
35
from django.conf import settings
46
from django.template import Library
57
from django.utils.translation import to_locale, get_language
@@ -10,22 +12,18 @@
1012

1113
from django_babel.middleware import get_current_locale
1214

13-
babel = __import__('babel', {}, {}, ['core', 'support'])
14-
Format = babel.support.Format
15-
Locale = babel.core.Locale
16-
1715
register = Library()
1816

1917

2018
def _get_format():
2119
locale = get_current_locale()
2220
if not locale:
23-
locale = Locale.parse(to_locale(get_language()))
21+
locale = babel_core.Locale.parse(to_locale(get_language()))
2422
if timezone:
2523
tzinfo = timezone(settings.TIME_ZONE)
2624
else:
2725
tzinfo = None
28-
return Format(locale, tzinfo)
26+
return babel_support.Format(locale, tzinfo)
2927

3028

3129
def datefmt(date=None, format='medium'):

0 commit comments

Comments
 (0)