#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 |
Description
(An offspring of #13032) If, for example, you have this in your settings:
USE_L10N = False NUMBER_GROUPING=1 THOUSAND_SEPARATOR='!' USE_THOUSAND_SEPARATOR=True
you get this in a manage.py 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 http://docs.djangoproject.com/en/dev/ref/settings/#use-thousand-separator 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)
Change History (4)
by , 16 years ago
| Attachment: | 13054.diff added |
|---|
comment:1 by , 16 years ago
| milestone: | → 1.2 |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
(In [12816]) Fixed #13054 - Only apply grouping to integer part of numbers if explicitly wanted. Thanks, Ramiro Morales.