MCPcopy
hub / github.com/django/django / escape

Function escape

django/utils/html.py:53–62  ·  django/utils/html.py::escape

Return the given text with ampersands, quotes and angle brackets encoded for use in HTML. Always escape input, even if it's already escaped and marked as such. This may result in double-escaping. If this is a concern, use conditional_escape() instead.

(text)

Source from the content-addressed store, hash-verified

51
52@keep_lazy(SafeString)
53def escape(text):
54 class="st">"""
55 Return the given text with ampersands, quotes and angle brackets encoded
56 for use in HTML.
57
58 Always escape input, even if it&class="cm">#x27;s already escaped and marked as such.
59 This may result in double-escaping. If this is a concern, use
60 conditional_escape() instead.
61 class="st">"""
62 return SafeString(html.escape(str(text)))
63
64
65_js_escapes = {

Callers 15

user_change_passwordMethod · 0.90
item_titleMethod · 0.90
processMethod · 0.90
processMethod · 0.90
get_json_dataMethod · 0.90
renderMethod · 0.90
linenumbersFunction · 0.90
force_escapeFunction · 0.90
linebreaksbrFunction · 0.90
test_get_history_viewMethod · 0.90
test_get_change_viewMethod · 0.90

Calls 1

SafeStringClass · 0.90