summaryrefslogtreecommitdiff
path: root/django/template
diff options
context:
space:
mode:
authorhaileyajohnson <haj022@ucsd.edu>2025-03-11 00:02:27 -0700
committerGitHub <noreply@github.com>2025-03-11 08:02:27 +0100
commit5183f7c287a9a5d61ca1103b55166cda52d9c647 (patch)
tree1f1e246780b088d5575bc0fb1b6a85f0bb135d61 /django/template
parent8df5ce80d26824ce72af41edc03275d435de9432 (diff)
Fixed #35816 -- Handled parsing of scientific notation in DTL. (#19213)
* Refs #35816 -- Improved test coverage of FilterExpression. * Fixed #35816 -- Made FilterExpression parse scientific numbers. --------- Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
Diffstat (limited to 'django/template')
-rw-r--r--django/template/base.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/django/template/base.py b/django/template/base.py
index eaca428b10..e586a27991 100644
--- a/django/template/base.py
+++ b/django/template/base.py
@@ -633,19 +633,18 @@ constant_string = constant_string.replace("\n", "")
filter_raw_string = r"""
^(?P<constant>%(constant)s)|
-^(?P<var>[%(var_chars)s]+|%(num)s)|
+^(?P<var>[%(var_chars)s]+)|
(?:\s*%(filter_sep)s\s*
(?P<filter_name>\w+)
(?:%(arg_sep)s
(?:
(?P<constant_arg>%(constant)s)|
- (?P<var_arg>[%(var_chars)s]+|%(num)s)
+ (?P<var_arg>[%(var_chars)s]+)
)
)?
)""" % {
"constant": constant_string,
- "num": r"[-+.]?\d[\d.e]*",
- "var_chars": r"\w\.",
+ "var_chars": r"\w\.\+-",
"filter_sep": re.escape(FILTER_SEPARATOR),
"arg_sep": re.escape(FILTER_ARGUMENT_SEPARATOR),
}