Opened 5 years ago

Closed 5 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



    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>/ to the value interpreted by Python as False, then Django skips returning it.

For example,

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

Attachments (2)

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

Download all attachments as: .zip

Change History (4)

Changed 5 years ago by Peter Bobov

small patch

comment:1 Changed 5 years ago by Ramiro Morales

Component: UncategorizedInternationalization
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

Changed 5 years ago by Julien Phalip

comment:2 Changed 5 years ago by Julien Phalip

Resolution: fixed
Status: newclosed

Fixed in r17017.

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