summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2010-09-12 19:40:44 +0000
committerJannis Leidel <jannis@leidel.info>2010-09-12 19:40:44 +0000
commit7bb6abed129015ad447bd78506698f34c4d8273b (patch)
tree3e3a4abdf310d6cad6cff1a38d8ca5a10c8b5706 /django
parent882cba0f69b1d2c0748b96315b34e3809aa59869 (diff)
Fixed #13702 -- Made sure to actually fall back to the l10n format strings provided in the settings, when disabled.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13770 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/conf/global_settings.py4
-rw-r--r--django/utils/formats.py20
2 files changed, 12 insertions, 12 deletions
diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
index 6033297e5c..2714bfb9ab 100644
--- a/django/conf/global_settings.py
+++ b/django/conf/global_settings.py
@@ -370,8 +370,8 @@ DECIMAL_SEPARATOR = '.'
# Boolean that sets whether to add thousand separator when formatting numbers
USE_THOUSAND_SEPARATOR = False
-# Number of digits that will be togheter, when spliting them by THOUSAND_SEPARATOR
-# 0 means no grouping, 3 means splitting by thousands...
+# Number of digits that will be together, when spliting them by
+# THOUSAND_SEPARATOR. 0 means no grouping, 3 means splitting by thousands...
NUMBER_GROUPING = 0
# Thousand separator symbol
diff --git a/django/utils/formats.py b/django/utils/formats.py
index 31027abd23..372998f221 100644
--- a/django/utils/formats.py
+++ b/django/utils/formats.py
@@ -79,16 +79,16 @@ def localize(value):
Checks if value is a localizable type (date, number...) and returns it
formatted as a string using current locale format
"""
- if settings.USE_L10N:
- if isinstance(value, (decimal.Decimal, float, int)):
- return number_format(value)
- elif isinstance(value, datetime.datetime):
- return date_format(value, 'DATETIME_FORMAT')
- elif isinstance(value, datetime.date):
- return date_format(value)
- elif isinstance(value, datetime.time):
- return time_format(value, 'TIME_FORMAT')
- return value
+ if isinstance(value, (decimal.Decimal, float, int)):
+ return number_format(value)
+ elif isinstance(value, datetime.datetime):
+ return date_format(value, 'DATETIME_FORMAT')
+ elif isinstance(value, datetime.date):
+ return date_format(value)
+ elif isinstance(value, datetime.time):
+ return time_format(value, 'TIME_FORMAT')
+ else:
+ return value
def localize_input(value, default=None):
"""