diff options
| author | haileyajohnson <haj022@ucsd.edu> | 2025-03-11 00:02:27 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-11 08:02:27 +0100 |
| commit | 5183f7c287a9a5d61ca1103b55166cda52d9c647 (patch) | |
| tree | 1f1e246780b088d5575bc0fb1b6a85f0bb135d61 /django/template | |
| parent | 8df5ce80d26824ce72af41edc03275d435de9432 (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.py | 7 |
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), } |
