MCPcopy
hub / github.com/django/django / join

Function join

django/template/defaultfilters.py:612–621  ·  view source on GitHub ↗

Join a list with a string, like Python's ``str.join(list)``.

(value, arg, autoescape=True)

Source from the content-addressed store, hash-verified

610
611@register.filter(is_safe=True, needs_autoescape=True)
612def join(value, arg, autoescape=True):
613 """Join a list with a string, like Python's ``str.join(list)``."""
614 try:
615 if autoescape:
616 data = conditional_escape(arg).join([conditional_escape(v) for v in value])
617 else:
618 data = arg.join(value)
619 except TypeError: # Fail silently if arg isn't iterable.
620 return value
621 return mark_safe(data)
622
623
624@register.filter(is_safe=True)

Callers 7

test_listMethod · 0.90
test_autoescapeMethod · 0.90
test_autoescape_offMethod · 0.90
test_noniterable_argMethod · 0.90
safe_joinFunction · 0.85
conf.pyFile · 0.85

Calls 3

conditional_escapeFunction · 0.90
mark_safeFunction · 0.90
joinMethod · 0.45

Tested by 5

test_listMethod · 0.72
test_autoescapeMethod · 0.72
test_autoescape_offMethod · 0.72
test_noniterable_argMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…