#25469: Add an auto escape setting to the Django template engine ---------------------------------+------------------------------------ Reporter: aidanlister | Owner: jgeskens Type: New feature | Status: assigned Component: Template system | Version: 1.8 Severity: Normal | Resolution: Keywords: templates | Triage Stage: Accepted Has patch: 1 | Needs documentation: 1 Needs tests: 0 | Patch needs improvement: 1 Easy pickings: 0 | UI/UX: 0 ---------------------------------+------------------------------------
Comment (by carljm): I don't believe the PR quite matches what Aymeric had suggested above ("add an autoescape option to the Django template library, similar to Jinja2"). The Jinja2 backend doesn't accept an `autoescape` argument to its `render` method, it has a global `autoescape` option for the engine, which is configured in the settings dict. I think that the signature of a template backend's `render` method should remain consistent between backends, and consistent with the documented signature, and not grow ad-hoc backend-specific additions. It's intended to be a generic lowest-common-denominator API; in the common case it is not called directly on the backend, but by the generic render() method. Backend configuration options, on the other hand, are intended to provide backend-specific configuration. Presuming we did this as a configuration option (to parallel the Jinja2 backend), your use case might require you to configure two instances of the DTL in your settings file, one with autoescape turned on and one with autoescape turned off. Aymeric, do you have any additional thoughts here? Do we need a way to pass per-render backend-specific options? Should the documented signature of a backend's render method include `**kwargs`, to be interpreted as desired by the backend? -- Ticket URL: <https://code.djangoproject.com/ticket/25469#comment:11> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/069.5668d26a3a0ed48034d98c55766a83ad%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.