summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2011-09-22 15:04:27 +0000
committerJannis Leidel <jannis@leidel.info>2011-09-22 15:04:27 +0000
commit66dc22c2d98c08a62588271507fd42bc7706541a (patch)
tree3eefd1c2a15b22a90b3bd0a362a932e705ed4fc0 /django
parentc59339f450343960ee5dd2e2bb8d1a8507ccdaba (diff)
Fixed #16909 -- Pass language to get_format_modules when calling it from get_format to make sure the correct module is returned.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16884 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/utils/formats.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/django/utils/formats.py b/django/utils/formats.py
index 2d8a813825..3babccb0a0 100644
--- a/django/utils/formats.py
+++ b/django/utils/formats.py
@@ -45,11 +45,12 @@ def iter_format_modules(lang):
except ImportError:
pass
-def get_format_modules(reverse=False):
+def get_format_modules(lang=None, reverse=False):
"""
Returns a list of the format modules found
"""
- lang = get_language()
+ if lang is None:
+ lang = get_language()
modules = _format_modules_cache.setdefault(lang, list(iter_format_modules(lang)))
if reverse:
return list(reversed(modules))
@@ -72,7 +73,7 @@ def get_format(format_type, lang=None, use_l10n=None):
try:
return _format_cache[cache_key] or getattr(settings, format_type)
except KeyError:
- for module in get_format_modules():
+ for module in get_format_modules(lang):
try:
val = getattr(module, format_type)
_format_cache[cache_key] = val