Refs #34000 -- Optimized handling None values in numberformat.format().

This commit is contained in:
Jimmy Angelakos 2022-09-12 12:59:14 +02:00 committed by Mariusz Felisiak
parent e911e0996f
commit 07ebef566f
2 changed files with 2 additions and 1 deletions

View File

@ -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)

View File

@ -175,3 +175,4 @@ class TestNumberFormat(SimpleTestCase):
def test_empty(self):
self.assertEqual(nformat("", "."), "")
self.assertEqual(nformat(None, "."), "None")