Jinja 2 safe keyword

I have a little problem understanding what an expression like {{ something.render() | safe }} does .

From what I have seen, without the safe keyword it outputs the entire html document, not just the true content.

What I would like to know, is what it actually does, how it functions .

Answers


The safe filter explicitly marks a string as "safe", i.e., it should not be automatically-escaped if auto-escaping is enabled.

The documentation on this filter is here.

See the section on manual escaping to see which characters qualify for escaping.


Need Your Help

How can I prevent database being written to again when the browser does a reload/back?

database perl cgi idempotent

I'm putting together a small web app that writes to a database (Perl CGI & MySQL). The CGI script takes some info from a form and writes it to a database. I notice, however, that if I hit 'R...

Decode HTML entity in Angular JS

javascript html angularjs html-entities utf8-decode

How do i decode HTML entity in text using angular JS.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.