mirror of
https://github.com/django/django.git
synced 2025-12-03 16:47:26 +00:00
Fixed #28662 -- Silenced join template filter error if arg isn't iterable.
This commit is contained in:
parent
d4fb742094
commit
f7036b3e26
2 changed files with 11 additions and 3 deletions
|
|
@ -518,11 +518,11 @@ def first(value):
|
|||
@register.filter(is_safe=True, needs_autoescape=True)
|
||||
def join(value, arg, autoescape=True):
|
||||
"""Join a list with a string, like Python's ``str.join(list)``."""
|
||||
if autoescape:
|
||||
value = [conditional_escape(v) for v in value]
|
||||
try:
|
||||
if autoescape:
|
||||
value = [conditional_escape(v) for v in value]
|
||||
data = conditional_escape(arg).join(value)
|
||||
except AttributeError: # fail silently but nicely
|
||||
except TypeError: # Fail silently if arg isn't iterable.
|
||||
return value
|
||||
return mark_safe(data)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue