Ticket #16938: fix_format_false_interpretation.patch

File fix_format_false_interpretation.patch, 991 bytes (added by Peter Bobov, 13 years ago)

small patch

  • django/utils/formats.py

    From 77d1e429ef1dc2da71540643d8482799c2e0bf6f Mon Sep 17 00:00:00 2001
    From: Peter <peter.bobov@gmail.com>
    Date: Tue, 27 Sep 2011 11:46:07 +0400
    Subject: [PATCH] Fixes django.utils.format. Now it returns format.py values even if they are interpreted as False; e.g. 0 or ''.
    
    ---
     django/utils/formats.py |    3 ++-
     1 files changed, 2 insertions(+), 1 deletions(-)
    
    diff --git a/django/utils/formats.py b/django/utils/formats.py
    index 3babccb..e05351d 100644
    a b def get_format(format_type, lang=None, use_l10n=None):  
    7171            lang = get_language()
    7272        cache_key = (format_type, lang)
    7373        try:
    74             return _format_cache[cache_key] or getattr(settings, format_type)
     74            fc = _format_cache[cache_key]
     75            return getattr(settings, format_type) if fc is None else fc
    7576        except KeyError:
    7677            for module in get_format_modules(lang):
    7778                try:
Back to Top