Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pprint jinja2 debug variable helper

I'm trying to use http://jinja.pocoo.org/docs/dev/templates/#pprint pprint function like this:

{{ pprint(player) }} in my html file, but I get the following error:

jinja2.exceptions.UndefinedError
UndefinedError: 'pprint' is undefined

Jinja2 is a template engine for python. Anyone could help me to display variables for easy debug?

like image 866
Vadorequest Avatar asked Sep 08 '14 16:09

Vadorequest


People also ask

How are variables in Jinja2 templates specified?

Variables. Template variables are defined by the context dictionary passed to the template. You can mess around with the variables in templates provided they are passed in by the application. Variables may have attributes or elements on them you can access too.


1 Answers

You have to use it this way:

{{ flash_messages|pprint }}

or in your case:

{{ player|pprint}}
like image 67
mehdix Avatar answered Oct 17 '22 00:10

mehdix