diff options
| author | Claude Paroz <claude@2xlibre.net> | 2017-08-22 14:45:08 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-08-22 08:45:08 -0400 |
| commit | ed77bea58274e11e5a9e4c8b9650f50deb8a2b26 (patch) | |
| tree | 52b9ef33e778da64515646c352baf14324cd89b8 /django | |
| parent | 7bba82453ce142e170325c28e684aa7ee719a0b3 (diff) | |
Refs #28502 -- Complemented stringformat tuple handling/test.
An additional test and a code change were suggested in a late review.
Diffstat (limited to 'django')
| -rw-r--r-- | django/template/defaultfilters.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py index a1b08e0921..b18b41c293 100644 --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -223,9 +223,9 @@ def stringformat(value, arg): See https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting for documentation of Python string formatting. """ + if isinstance(value, tuple): + value = str(value) try: - if isinstance(value, tuple): - return ('%' + str(arg)) % str(value) return ("%" + str(arg)) % value except (ValueError, TypeError): return "" |
