mako

Mako, use if / else control structure in one line

Mako, use if / else control structure in one line Question: I would like to do something like this, restricted on on line. I can’t use multi line. % if object.lang == ‘fr_FR’: ‘Rappel de paimenet’ % else: ‘Payment reminder’ %endif I know that this is not the good syntax, but I did find in …

Total answers: 4

Insert javascript at top of including file in Jinja 2

Insert javascript at top of including file in Jinja 2 Question: In Jinja2, I would like the following to work as it looks like it should, by running: from jinja2 import Environment, FileSystemLoader env = Environment(loader=FileSystemLoader(‘.’)) template = env.get_template(‘x.html’) print template.render() Essentially the objective is to coalesce all the javascript into the <head> tags by …

Total answers: 5

Mako or Jinja2?

Mako or Jinja2? Question: I didn’t find a good comparison of jinja2 and Mako. What would you use for what tasks ? I personnaly was satisfied by mako (in a pylons web app context) but am curious to know if jinja2 has some nice features/improvements that mako doesn’t ? -or maybe downsides ?- Asked By: …

Total answers: 2

What is the fastest template system for Python?

What is the fastest template system for Python? Question: Jinja2 and Mako are both apparently pretty fast. How do these compare to (the less featured but probably good enough for what I’m doing) string.Template ? Asked By: Josh Gibson || Source Answers: From the jinja2 docs, it seems that string.Template is the fastest if that’s …

Total answers: 5