diff options
| author | Julien Phalip <jphalip@gmail.com> | 2011-10-20 12:14:06 +0000 |
|---|---|---|
| committer | Julien Phalip <jphalip@gmail.com> | 2011-10-20 12:14:06 +0000 |
| commit | 1452cecd154c9a77af85e6a5b09e334797779be4 (patch) | |
| tree | de4606384459c8daf851c92241793a133127e416 /django | |
| parent | 51b8f0a2402d56ec84c2f12045291c0f7e6862e6 (diff) | |
Fixed 16938 -- Ensured that the active locale's formats take precedence over the default settings even if they would be interpreted as False in a conditional test (e.g. 0 or empty string). Thanks to pikerr for the report and initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17017 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/utils/formats.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/django/utils/formats.py b/django/utils/formats.py index 3babccb0a0..e283490b17 100644 --- a/django/utils/formats.py +++ b/django/utils/formats.py @@ -71,7 +71,12 @@ def get_format(format_type, lang=None, use_l10n=None): lang = get_language() cache_key = (format_type, lang) try: - return _format_cache[cache_key] or getattr(settings, format_type) + cached = _format_cache[cache_key] + if cached is not None: + return cached + else: + # Return the general setting by default + return getattr(settings, format_type) except KeyError: for module in get_format_modules(lang): try: |
