简体   繁体   中英

Jinja2 autoescape

Autoescape is set to false globally. Is there a way to tell Jinja2 to escape a specific template?

The {% autoescape false %} block apparently only works for disabling autoescape in templates if the global settings is set to true and not the other way around.

Which version of Jinja2 are you using? Is it used on a Flask/Django context or something else? I tested with Flask==1.1.1 and Jinja2==2.10.1 and what I observed is that autoescape is enabled by default when using render_template .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM