Skip to content

Commit 86c5abb

Browse files
committed
Cleanup and a bit of modernization.
1 parent 258ae80 commit 86c5abb

File tree

6 files changed

+35
-81
lines changed

6 files changed

+35
-81
lines changed

babeldjango/__init__.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +0,0 @@
1-
# -*- coding: utf-8 -*-
2-
#
3-
# Copyright (C) 2007 Edgewall Software
4-
# All rights reserved.
5-
#
6-
# This software is licensed as described in the file COPYING, which
7-
# you should have received as part of this distribution. The terms
8-
# are also available at http://babel.edgewall.org/wiki/License.
9-
#
10-
# This software consists of voluntary contributions made by many
11-
# individuals. For the exact contribution history, see the revision
12-
# history and logs, available at http://babel.edgewall.org/log/.

babeldjango/extract.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
#
3-
# Copyright (C) 2007 Edgewall Software
4-
# All rights reserved.
5-
#
6-
# This software is licensed as described in the file COPYING, which
7-
# you should have received as part of this distribution. The terms
8-
# are also available at http://babel.edgewall.org/wiki/License.
9-
#
10-
# This software consists of voluntary contributions made by many
11-
# individuals. For the exact contribution history, see the revision
12-
# history and logs, available at http://babel.edgewall.org/log/.
132

143
from babel.core import *
154

@@ -18,6 +7,7 @@
187
endblock_re, plural_re, \
198
constant_re
209

10+
2111
def extract_django(fileobj, keywords, comment_tags, options):
2212
"""Extract messages from Django template files.
2313

babeldjango/middleware.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
#
3-
# Copyright (C) 2007-2010 Edgewall Software
4-
# All rights reserved.
5-
#
6-
# This software is licensed as described in the file COPYING, which
7-
# you should have received as part of this distribution. The terms
8-
# are also available at http://babel.edgewall.org/wiki/License.
9-
#
10-
# This software consists of voluntary contributions made by many
11-
# individuals. For the exact contribution history, see the revision
12-
# history and logs, available at http://babel.edgewall.org/log/.
132

143
from babel import Locale, UnknownLocaleError
154
from django.utils.translation import get_language
@@ -22,10 +11,11 @@
2211

2312
_thread_locals = local()
2413

14+
2515
def get_current_locale():
2616
"""Get current locale data outside views.
2717
28-
See http://babel.edgewall.org/wiki/ApiDocs/babel.core for Locale
18+
See http://babel.pocoo.org/docs/api/core/#babel.core.Locale for Locale
2919
objects documentation
3020
"""
3121
return getattr(_thread_locals, 'locale', None)

babeldjango/templatetags/__init__.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +0,0 @@
1-
# -*- coding: utf-8 -*-
2-
#
3-
# Copyright (C) 2007 Edgewall Software
4-
# All rights reserved.
5-
#
6-
# This software is licensed as described in the file COPYING, which
7-
# you should have received as part of this distribution. The terms
8-
# are also available at http://babel.edgewall.org/wiki/License.
9-
#
10-
# This software consists of voluntary contributions made by many
11-
# individuals. For the exact contribution history, see the revision
12-
# history and logs, available at http://babel.edgewall.org/log/.

babeldjango/templatetags/babel.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
#
3-
# Copyright (C) 2007 Edgewall Software
4-
# All rights reserved.
5-
#
6-
# This software is licensed as described in the file COPYING, which
7-
# you should have received as part of this distribution. The terms
8-
# are also available at http://babel.edgewall.org/wiki/License.
9-
#
10-
# This software consists of voluntary contributions made by many
11-
# individuals. For the exact contribution history, see the revision
12-
# history and logs, available at http://babel.edgewall.org/log/.
132

143
from django.conf import settings
154
from django.template import Library
@@ -27,6 +16,7 @@
2716

2817
register = Library()
2918

19+
3020
def _get_format():
3121
locale = get_current_locale()
3222
if not locale:
@@ -37,34 +27,42 @@ def _get_format():
3727
tzinfo = None
3828
return Format(locale, tzinfo)
3929

30+
31+
@register.filter
4032
def datefmt(date=None, format='medium'):
4133
return _get_format().date(date, format=format)
42-
datefmt = register.filter(datefmt)
4334

35+
36+
@register.filter
4437
def datetimefmt(datetime=None, format='medium'):
4538
return _get_format().datetime(datetime, format=format)
46-
datetimefmt = register.filter(datetimefmt)
4739

40+
41+
@register.filter
4842
def timefmt(time=None, format='medium'):
4943
return _get_format().time(time, format=format)
50-
timefmt = register.filter(timefmt)
5144

45+
46+
@register.filter
5247
def numberfmt(number):
5348
return _get_format().number(number)
54-
numberfmt = register.filter(numberfmt)
5549

50+
51+
@register.filter
5652
def decimalfmt(number, format=None):
5753
return _get_format().decimal(number, format=format)
58-
decimalfmt = register.filter(decimalfmt)
5954

55+
56+
@register.filter
6057
def currencyfmt(number, currency):
6158
return _get_format().currency(number, currency)
62-
currencyfmt = register.filter(currencyfmt)
6359

60+
61+
@register.filter
6462
def percentfmt(number, format=None):
6563
return _get_format().percent(number, format=format)
66-
percentfmt = register.filter(percentfmt)
6764

65+
66+
@register.filter
6867
def scientificfmt(number):
6968
return _get_format().scientific(number)
70-
scientificfmt = register.filter(scientificfmt)

setup.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3-
#
4-
# Copyright (C) 2007 Edgewall Software
5-
# All rights reserved.
6-
#
7-
# This software is licensed as described in the file COPYING, which
8-
# you should have received as part of this distribution. The terms
9-
# are also available at http://babel.edgewall.org/wiki/License.
10-
#
11-
# This software consists of voluntary contributions made by many
12-
# individuals. For the exact contribution history, see the revision
13-
# history and logs, available at http://babel.edgewall.org/log/.
143

154
try:
165
from setuptools import setup
@@ -20,15 +9,26 @@
209
setup(
2110
name = 'BabelDjango',
2211
description = 'Utilities for using Babel in Django',
23-
version = '0.2.3',
12+
version = '1.0',
2413
license = 'BSD',
25-
author = 'Edgewall Software',
26-
author_email = 'python-babel@googlegroups.com',
27-
url = 'http://babel.edgewall.org/wiki/BabelDjango',
14+
author = 'Christopher Lenz',
15+
author_email = 'cmlenz@gmail.com',
16+
url = 'https://github.com/cmlenz/django-babel',
2817

2918
packages = ['babeldjango', 'babeldjango.templatetags'],
3019
install_requires = ['Babel'],
3120

21+
classifiers=[
22+
'Development Status :: 5 - Production/Stable',
23+
'Environment :: Web Environment',
24+
'Intended Audience :: Developers',
25+
'License :: OSI Approved :: BSD License',
26+
'Operating System :: OS Independent',
27+
'Programming Language :: Python',
28+
'Programming Language :: Python :: 3',
29+
'Topic :: Software Development :: Libraries :: Python Modules',
30+
],
31+
3232
entry_points = """
3333
[babel.extractors]
3434
django = babeldjango.extract:extract_django

0 commit comments

Comments
 (0)