1

I have just started building my first Flask app, which currently simply returns output of inspect for my objects inside table tags. The problem is that instead of the html I expect, a template engine messes layout up creating new tags (I guess it parses dict's curly brackets).

Andrei
  • 10,918
  • 12
  • 76
  • 110

1 Answers1

4

From your question I don't really understand, why and where this inspect is ran, but it is possible to escape output like this:

{{ object | e }}

Or you can escape things inside template by using 'foo' or {% raw %}:

{{ '{{' }}

{% raw %}
   {% %}
{% endraw %}
plaes
  • 31,788
  • 11
  • 91
  • 89
  • Thanks for your answer! The actual problem was in `<>` brackets around strings representing variables, and that Chrome has added extra closing tags in the inspect window, which led me to the wrong conclusion. – Andrei Sep 17 '11 at 17:15
  • Really helps when using Javascript templating library like jQuery.tmpl as the syntax is similar. – sax Mar 10 '12 at 00:26
  • seams this doesn't work anymore and you need to do `{{ object|safe }}` https://stackoverflow.com/a/3206446/10917416 – RawSlugs Oct 03 '22 at 19:25