summaryrefslogtreecommitdiff
path: root/django/utils/numberformat.py
diff options
context:
space:
mode:
authorJimmy Angelakos <vyruss@hellug.gr>2022-09-10 14:04:45 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-09-12 12:54:12 +0200
commite911e0996f1096cc23ef03b1ca70da7499dd8f2f (patch)
treecb3d4d4f5652b3bc686da1b9eb85a8b197dd1a9e /django/utils/numberformat.py
parentec13e801b820614ff374cb0046092caab8d67249 (diff)
Fixed #34000 -- Fixed numberformat.format() crash on empty strings.
Diffstat (limited to 'django/utils/numberformat.py')
-rw-r--r--django/utils/numberformat.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/utils/numberformat.py b/django/utils/numberformat.py
index 488d6a77cd..35bbdd39e1 100644
--- a/django/utils/numberformat.py
+++ b/django/utils/numberformat.py
@@ -25,6 +25,8 @@ def format(
module in locale.localeconv() LC_NUMERIC grouping (e.g. (3, 2, 0)).
* thousand_sep: Thousand separator symbol (for example ",")
"""
+ if number == "":
+ return mark_safe(number)
use_grouping = (
use_l10n or (use_l10n is None and settings.USE_L10N)
) and settings.USE_THOUSAND_SEPARATOR