Opened 13 years ago

Closed 13 years ago

#16938 closed Bug (fixed)

django.utils.formats.get_format skips values interpreted as false

Reported by: Peter Bobov Owned by: nobody
Component: Internationalization Version: 1.3
Severity: Normal Keywords: utils get_format
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Here

    return _format_cache[cache_key] or getattr(settings, format_type)

it tries to evaluate getattr if _format_cache[cache_key] interprets as false.
Thereby if user sets some value in <LOCALE>/formats.py to the value interpreted by Python as False, then Django skips returning it.

For example,

if I set <SOME_LOCALE>/formats.py's THOUSAND_SEPARATOR to '' Django takes value from django.conf.settings instead of formats.py.

Attachments (2)

fix_format_false_interpretation.patch (991 bytes ) - added by Peter Bobov 13 years ago.
small patch
16938.empty-string-locale-format.diff (2.6 KB ) - added by Julien Phalip 13 years ago.

Download all attachments as: .zip

Change History (4)

by Peter Bobov, 13 years ago

small patch

comment:1 by Ramiro Morales, 13 years ago

Component: UncategorizedInternationalization
Triage Stage: UnreviewedAccepted

by Julien Phalip, 13 years ago

comment:2 by Julien Phalip, 13 years ago

Resolution: fixed
Status: newclosed

Fixed in r17017.

Note: See TracTickets for help on using tickets.
Back to Top