Difference between {% and {%-

193 views
Skip to first unread message

Vicente Olivert Riera

unread,
Oct 22, 2014, 12:00:59 PM10/22/14
to python-...@googlegroups.com
Hello,

I have no idea about Tornado, but for job reasons I have to deal with a project which is using it.

I think {% is the open tag for a template directive, but I the code I'm looking at it's mixing {% and {%-. What's the difference between them?

Example of what I find in that code:

{% for strip in grid -%}

another example:

{%- if strip[i] -%}

Someone in the #python IRC channel told me this:

"in jinja2 it affects whether whitespace is printed, but it's not documented for tornado at all AFAICT. Maybe it does the same thing."

Can anyone tell me difference between {% and {%- please?

Thanks

Ben Darnell

unread,
Oct 26, 2014, 8:51:37 PM10/26/14
to Tornado Mailing List
'{%-' is a syntax error in Tornado templates. Are you sure this application is using Tornado templates, and not using something like jinja2 from a Tornado server?

--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vicente Olivert Riera

unread,
Oct 26, 2014, 8:52:39 PM10/26/14
to python-...@googlegroups.com

You are right, it is jinga2. Sorry.

You received this message because you are subscribed to a topic in the Google Groups "Tornado Web Server" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-tornado/lrcvz1YB-7M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-tornad...@googlegroups.com.

Vicente Olivert Riera

unread,
Oct 26, 2014, 8:53:14 PM10/26/14
to python-...@googlegroups.com

jinja2

Reply all
Reply to author
Forward
0 new messages