#35296: The autoescape parameter to Engine() seems to have no effect
-------------------------------------------+------------------------
Reporter: Roman Donchenko | Owner: nobody
Type: Uncategorized | Status: new
Component: Template system | Version: 5.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
The reference documentation for `django.template.Engine` says
[
https://docs.djangoproject.com/en/5.0/ref/templates/api/#configuring-an-
engine the following]:
* `autoescape` controls whether HTML autoescaping is enabled.
It defaults to `True`.
Based on this, I would expect the following to print `<>`:
{{{#!python
import django.template
django.template.Engine(autoescape=False)
t = e.from_string('{{x}}')
print(t.render(django.template.Context({'x': '<>'})))
}}}
But it doesn't, it prints `<>`. So it seems that the `autoescape`
parameter does nothing.
Either the code should be updated to make the parameter work, or the docs
should explain what it actually does.
--
Ticket URL: <
https://code.djangoproject.com/ticket/35296>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.