mirror of https://github.com/django/django.git
Refs #34000 -- Optimized handling None values in numberformat.format().
This commit is contained in:
parent
e911e0996f
commit
07ebef566f
|
@ -25,7 +25,7 @@ def format(
|
|||
module in locale.localeconv() LC_NUMERIC grouping (e.g. (3, 2, 0)).
|
||||
* thousand_sep: Thousand separator symbol (for example ",")
|
||||
"""
|
||||
if number == "":
|
||||
if number is None or number == "":
|
||||
return mark_safe(number)
|
||||
use_grouping = (
|
||||
use_l10n or (use_l10n is None and settings.USE_L10N)
|
||||
|
|
|
@ -175,3 +175,4 @@ class TestNumberFormat(SimpleTestCase):
|
|||
|
||||
def test_empty(self):
|
||||
self.assertEqual(nformat("", "."), "")
|
||||
self.assertEqual(nformat(None, "."), "None")
|
||||
|
|
Loading…
Reference in New Issue