MCPcopy
hub / github.com/django/django / safestring_in_template_exception

Function safestring_in_template_exception

tests/view_tests/views.py:91–100  ·  view source on GitHub ↗

Trigger an exception in the template machinery which causes a SafeString to be inserted as args[0] of the Exception.

(request)

Source from the content-addressed store, hash-verified

89
90
91def safestring_in_template_exception(request):
92 """
93 Trigger an exception in the template machinery which causes a SafeString
94 to be inserted as args[0] of the Exception.
95 """
96 template = Template('{% extends "<script>alert(1);</script>" %}')
97 try:
98 template.render(Context())
99 except Exception:
100 return technical_500_response(request, *sys.exc_info())
101
102
103def jsi18n(request):

Callers

nothing calls this directly

Calls 4

renderMethod · 0.95
TemplateClass · 0.90
ContextClass · 0.90
technical_500_responseFunction · 0.90

Tested by

no test coverage detected