Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#13054 closed (fixed)

integer part grouping settings does not respect USE_L10N setting value, changes behavior of floatformat

Reported by: Ramiro Morales Owned by: nobody
Component: Internationalization Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


(An offspring of #13032) If, for example, you have this in your settings:

USE_L10N = False


you get this in a shell session:

In [1]: from django.template import Template, Context

In [2]: Template('{{ n|floatformat }}').render(Context({'n': 100}))
Out[2]: u'1!0!0'

i.e. the thousand and grouping formatting settings values get used even if USE_L10N is False. This is either a code implementation bug or our documentation at isn't clear enough.

I'm inclined to think it is a bug because this hypothetical scenario: An user has set NUMBER_GROUPING to a value > 0 and USE_THOUSAND_SEPARATOR = True but sets USE_L10N = False thinking it's a master switch that turns the locale-aware formatting machinery off. But the floatformat filter still messes with the part to the left of the decimal separator.

The default value of NUMBER_GROUPING is 0 and that's why we haven't seen report of this yet.

Attachments (1)

13054.diff (6.4 KB ) - added by Ramiro Morales 14 years ago.

Download all attachments as: .zip

Change History (4)

by Ramiro Morales, 14 years ago

Attachment: 13054.diff added

comment:1 by Russell Keith-Magee, 14 years ago

milestone: 1.2
Triage Stage: UnreviewedAccepted

comment:2 by Jannis Leidel, 14 years ago

Resolution: fixed
Status: newclosed

(In [12816]) Fixed #13054 - Only apply grouping to integer part of numbers if explicitly wanted. Thanks, Ramiro Morales.

comment:3 by Jacob, 12 years ago

milestone: 1.2

Milestone 1.2 deleted

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