autoescaping is enabled for all templates ending in .html, .htm, .xml as well as .xhtml
How do I enable autoescaping for templates ending with a .jhtml extension?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Thanks to @Cagez’s answer I was able to come up with a robust (and recommended) solution.
According to a post on the Flask mailing list, the way to do this is to override
flask.Flask.select_jinja_autoescape(). The linked snippet in that post demonstrating how to override which templates are autoescaped didn’t quite work, so I came up with the following, which does work:I put this at the top of my main Flask app file, replacing the usual
app = Flask(__name__)