Questions tagged [jinja2]

Jinja2 is a fast template engine for Python. It has full Unicode support, auto-escaping, inheritance, macros, and many other features.

Jinja2 is a fast template engine for Python. It is the default template engine in , can be integrated in other frameworks such as , or can be used without a framework. Features include:

  • Compose complex pages by inheriting from or including other templates
  • Automatic HTML escaping to prevent cross site scripting
  • Write reusable template macros and import them in other templates
  • Call functions with positional and keyword arguments
  • High performance with just in time compilation to Python bytecode
  • Optional ahead of time compilation
  • Optional sandboxed execution environment
  • Wide range of helpful functions for template designers
9474 questions
44
votes
6 answers

How do you debug Mako templates?

So far I've found it impossible to produce usable tracebacks when Mako templates aren't coded correctly. Is there any way to debug templates besides iterating for every line of code?
Nikhil
  • 5,705
  • 1
  • 32
  • 30
44
votes
3 answers

check variable type inside Jinja2 in Flask

The template file i created contains this: {% if type({'a':1,'b':2}) is dict %} print "Oh Yes!!" {% else %} print "Oh No!!!" {% endif %} Then Jinja2 responds by saying: TemplateAssertionError: no test named 'dict' I am completely new to…
Rakib
  • 12,376
  • 16
  • 77
  • 113
44
votes
1 answer

Creating link to an url of Flask app in jinja2 template

In my Flask app, I have a view which displays a post @post_blueprint.route('/post///') def get_post(year,month,title): # My code To display the last 10 entries, I have following…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/python" class="post-tag grid--cell" title="show questions tagged 'python'" rel="tag">python</a> <a href="../../questions/tagged/flask" class="post-tag grid--cell" title="show questions tagged 'flask'" rel="tag">flask</a> <a href="../../questions/tagged/jinja2" class="post-tag grid--cell" title="show questions tagged 'jinja2'" rel="tag">jinja2</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jun 20 '12 at 17:28">asked Jun 20 '12 at 17:28</time> <a href="../../users/679047/codecool" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/679047.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="codecool" /> </a> <div class="s-user-card--info"> <a href="../../users/679047/codecool" class="s-user-card--link">codecool</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">5,886</li> <li class="s-award-bling s-award-bling__gold" title="4 gold badges">4</li> <li class="s-award-bling s-award-bling__silver" title="29 silver badges">29</li> <li class="s-award-bling s-award-bling__bronze" title="40 bronze badges">40</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-7337814"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>43</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>3</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/7337814/jinja2-load-template-file-from-template" class="question-hyperlink">jinja2 load template file from template</a></h3> <div class="excerpt">Is there a way I can load a jinja2 template from within another template file? Something like {{ render_template('path/to/file.html') }} I have some snippets which I want to reuse, so it's important for me to have this functionality. </div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/jinja2" class="post-tag grid--cell" title="show questions tagged 'jinja2'" rel="tag">jinja2</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Sep 07 '11 at 17:11">asked Sep 07 '11 at 17:11</time> <a href="../../users/762174/romeo-m" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/762174.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Romeo M." /> </a> <div class="s-user-card--info"> <a href="../../users/762174/romeo-m" class="s-user-card--link">Romeo M.</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">3,218</li> <li class="s-award-bling s-award-bling__gold" title="8 gold badges">8</li> <li class="s-award-bling s-award-bling__silver" title="35 silver badges">35</li> <li class="s-award-bling s-award-bling__bronze" title="40 bronze badges">40</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-55463849"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>43</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>3</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/55463849/how-can-i-escape-double-curly-braces-in-jinja2" class="question-hyperlink">How can I escape double curly braces in jinja2?</a></h3> <div class="excerpt">I need to escape double curly braces in a code I'm working on using Ansible. The thing is I have all those parameters that needs to be transformed in variables. Basically I'm working on a template creator. I've tried using {% raw %}{{…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/ansible" class="post-tag grid--cell" title="show questions tagged 'ansible'" rel="tag">ansible</a> <a href="../../questions/tagged/jinja2" class="post-tag grid--cell" title="show questions tagged 'jinja2'" rel="tag">jinja2</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Apr 01 '19 at 21:30">asked Apr 01 '19 at 21:30</time> <a href="../../users/10394770/gr0gu3" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/10394770.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="gr0gu3" /> </a> <div class="s-user-card--info"> <a href="../../users/10394770/gr0gu3" class="s-user-card--link">gr0gu3</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">555</li> <li class="s-award-bling s-award-bling__gold" title="1 gold badge">1</li> <li class="s-award-bling s-award-bling__silver" title="6 silver badge">6</li> <li class="s-award-bling s-award-bling__bronze" title="11 bronze badge">11</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-41791055"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>43</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>4</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/41791055/conditional-substring-in-a-jinja2-template" class="question-hyperlink">Conditional substring in a Jinja2 template</a></h3> <div class="excerpt">When deploying with ansible, There's 1 specific case where I need to strip a string of a trailing -p substring. The string somemachine-prod-p should become somemachine-prod only if the -p is at the end. The substring function I saw I can use with…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/substring" class="post-tag grid--cell" title="show questions tagged 'substring'" rel="tag">substring</a> <a href="../../questions/tagged/ansible" class="post-tag grid--cell" title="show questions tagged 'ansible'" rel="tag">ansible</a> <a href="../../questions/tagged/jinja2" class="post-tag grid--cell" title="show questions tagged 'jinja2'" rel="tag">jinja2</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jan 22 '17 at 12:46">asked Jan 22 '17 at 12:46</time> <a href="../../users/5783481/moshe" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/5783481.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Moshe" /> </a> <div class="s-user-card--info"> <a href="../../users/5783481/moshe" class="s-user-card--link">Moshe</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">4,635</li> <li class="s-award-bling s-award-bling__gold" title="6 gold badges">6</li> <li class="s-award-bling s-award-bling__silver" title="32 silver badges">32</li> <li class="s-award-bling s-award-bling__bronze" title="57 bronze badges">57</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-37160668"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>43</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>3</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/37160668/check-if-strings-are-equals-and-ternary-operator-in-ansible" class="question-hyperlink">Check if strings are equals and ternary operator in Ansible</a></h3> <div class="excerpt">In my playbook, I have this: #More things - include: deploy_new.yml vars: service_type: "{{ expose_service == 'true' | ternary('NodePort', 'ClusterIP') }}" when: service_up|failed When expose_service is true, I want service_type to be set…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/ansible" class="post-tag grid--cell" title="show questions tagged 'ansible'" rel="tag">ansible</a> <a href="../../questions/tagged/jinja2" class="post-tag grid--cell" title="show questions tagged 'jinja2'" rel="tag">jinja2</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked May 11 '16 at 11:01">asked May 11 '16 at 11:01</time> <a href="../../users/3026283/hector" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/3026283.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Héctor" /> </a> <div class="s-user-card--info"> <a href="../../users/3026283/hector" class="s-user-card--link">Héctor</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">24,444</li> <li class="s-award-bling s-award-bling__gold" title="35 gold badges">35</li> <li class="s-award-bling s-award-bling__silver" title="132 silver badges">132</li> <li class="s-award-bling s-award-bling__bronze" title="243 bronze badges">243</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-28294816"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>43</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/28294816/remove-the-empty-lines-left-by-jinja2-variable-definitions" class="question-hyperlink">Remove the empty lines left by Jinja2 variable definitions</a></h3> <div class="excerpt">When writing template files using Jinja2 for Saltstack, I often define some variables at the beginning of the file. For example: {% set ip = grains['ip4_interfaces']['eth1'][0] %} {% set domain = pillar['company_domain'] %} {% set version =…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/jinja2" class="post-tag grid--cell" title="show questions tagged 'jinja2'" rel="tag">jinja2</a> <a href="../../questions/tagged/salt-stack" class="post-tag grid--cell" title="show questions tagged 'salt-stack'" rel="tag">salt-stack</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Feb 03 '15 at 08:54">asked Feb 03 '15 at 08:54</time> <a href="../../users/3719845/itchap" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/3719845.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="ITChap" /> </a> <div class="s-user-card--info"> <a href="../../users/3719845/itchap" class="s-user-card--link">ITChap</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">4,057</li> <li class="s-award-bling s-award-bling__gold" title="1 gold badge">1</li> <li class="s-award-bling s-award-bling__silver" title="21 silver badge">21</li> <li class="s-award-bling s-award-bling__bronze" title="46 bronze badge">46</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-23264226"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>43</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>3</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/23264226/how-to-write-dynamic-variable-in-ansible-playbook" class="question-hyperlink">How to write dynamic variable in Ansible playbook</a></h3> <div class="excerpt">Based on extra vars parameter I Need to write variable value in ansible playbook ansible-playbook playbook.yml -e "param1=value1 param2=value2 param3=value3" If only param1 passed myvariable: 'param1' If only param1,param2 passed myvariable:…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/jinja2" class="post-tag grid--cell" title="show questions tagged 'jinja2'" rel="tag">jinja2</a> <a href="../../questions/tagged/ansible" class="post-tag grid--cell" title="show questions tagged 'ansible'" rel="tag">ansible</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Apr 24 '14 at 08:55">asked Apr 24 '14 at 08:55</time> <a href="../../users/1838307/roopendra" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/1838307.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Roopendra" /> </a> <div class="s-user-card--info"> <a href="../../users/1838307/roopendra" class="s-user-card--link">Roopendra</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">7,674</li> <li class="s-award-bling s-award-bling__gold" title="16 gold badges">16</li> <li class="s-award-bling s-award-bling__silver" title="65 silver badges">65</li> <li class="s-award-bling s-award-bling__bronze" title="92 bronze badges">92</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-10821539"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>43</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>4</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/10821539/jinja-keep-indentation-on-include-or-macro" class="question-hyperlink">Jinja keep indentation on include or macro</a></h3> <div class="excerpt">I am wondering if there is any way to keep the indentation with jinja when adding a include or macro inside a file. I would like to use jinja to generating a code file. An example would be File: class.html class MyClass: def someOp(): …</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/templates" class="post-tag grid--cell" title="show questions tagged 'templates'" rel="tag">templates</a> <a href="../../questions/tagged/jinja2" class="post-tag grid--cell" title="show questions tagged 'jinja2'" rel="tag">jinja2</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked May 30 '12 at 17:47">asked May 30 '12 at 17:47</time> <a href="../../users/136401/razvi" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/136401.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Razvi" /> </a> <div class="s-user-card--info"> <a href="../../users/136401/razvi" class="s-user-card--link">Razvi</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">2,808</li> <li class="s-award-bling s-award-bling__gold" title="5 gold badges">5</li> <li class="s-award-bling s-award-bling__silver" title="31 silver badges">31</li> <li class="s-award-bling s-award-bling__bronze" title="39 bronze badges">39</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-26276580"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>42</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>3</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/26276580/how-to-get-current-url-in-jinja2-flask-request-url-not-working" class="question-hyperlink">How to get current URL in jinja2/flask (request.url not working)</a></h3> <div class="excerpt">Is there a way to print the current URL in Jinja2/Flask? E.g. if the current URL is http://www.domain.com/example/1/2 {{ request.path }} works and prints /example/1/2, but how to I get the full URL with http:// as well? From the docs (here){{…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/python" class="post-tag grid--cell" title="show questions tagged 'python'" rel="tag">python</a> <a href="../../questions/tagged/flask" class="post-tag grid--cell" title="show questions tagged 'flask'" rel="tag">flask</a> <a href="../../questions/tagged/jinja2" class="post-tag grid--cell" title="show questions tagged 'jinja2'" rel="tag">jinja2</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Oct 09 '14 at 10:52">asked Oct 09 '14 at 10:52</time> <a href="../../users/2429989/alias51" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/2429989.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="alias51" /> </a> <div class="s-user-card--info"> <a href="../../users/2429989/alias51" class="s-user-card--link">alias51</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">8,178</li> <li class="s-award-bling s-award-bling__gold" title="22 gold badges">22</li> <li class="s-award-bling s-award-bling__silver" title="94 silver badges">94</li> <li class="s-award-bling s-award-bling__bronze" title="166 bronze badges">166</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-1976651"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>42</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>8</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/1976651/multiple-level-template-inheritance-in-jinja2" class="question-hyperlink">Multiple level template inheritance in Jinja2?</a></h3> <div class="excerpt">I do html/css by trade, and I have been working on and off django projects as a template designer. I'm currently working on a site that uses Jinja2, which I have been using for about 2 weeks. I just found out through reading the documentation that…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/python" class="post-tag grid--cell" title="show questions tagged 'python'" rel="tag">python</a> <a href="../../questions/tagged/css" class="post-tag grid--cell" title="show questions tagged 'css'" rel="tag">css</a> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/django-templates" class="post-tag grid--cell" title="show questions tagged 'django-templates'" rel="tag">django-templates</a> <a href="../../questions/tagged/jinja2" class="post-tag grid--cell" title="show questions tagged 'jinja2'" rel="tag">jinja2</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Dec 29 '09 at 20:03">asked Dec 29 '09 at 20:03</time> <a href="../../users/240287/rey" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/240287.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Rey" /> </a> <div class="s-user-card--info"> <a href="../../users/240287/rey" class="s-user-card--link">Rey</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">3,639</li> <li class="s-award-bling s-award-bling__gold" title="5 gold badges">5</li> <li class="s-award-bling s-award-bling__silver" title="33 silver badges">33</li> <li class="s-award-bling s-award-bling__bronze" title="40 bronze badges">40</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-11947325"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>42</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>5</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/11947325/how-to-test-for-a-list-in-jinja2" class="question-hyperlink">How to test for a List in Jinja2?</a></h3> <div class="excerpt">As far as I can see, there is no way to test if an object is a List instance in Jinja2. Is that correct and has anyone implemented a custom test/extension in Jinja2? </div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/python" class="post-tag grid--cell" title="show questions tagged 'python'" rel="tag">python</a> <a href="../../questions/tagged/jinja2" class="post-tag grid--cell" title="show questions tagged 'jinja2'" rel="tag">jinja2</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Aug 14 '12 at 07:04">asked Aug 14 '12 at 07:04</time> <a href="../../users/682308/mfb" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/682308.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="MFB" /> </a> <div class="s-user-card--info"> <a href="../../users/682308/mfb" class="s-user-card--link">MFB</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">19,017</li> <li class="s-award-bling s-award-bling__gold" title="27 gold badges">27</li> <li class="s-award-bling s-award-bling__silver" title="72 silver badges">72</li> <li class="s-award-bling s-award-bling__bronze" title="118 bronze badges">118</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-5040532"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>41</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>7</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/5040532/python-ascii-codec-can-t-decode-byte" class="question-hyperlink">Python - 'ascii' codec can't decode byte</a></h3> <div class="excerpt">I'm using Python 2.6 and Jinja2 to create HTML reports. I provide the template with many results and the template loops through them and creates HTML tables When calling template.render, I've suddenly started getting this…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/python" class="post-tag grid--cell" title="show questions tagged 'python'" rel="tag">python</a> <a href="../../questions/tagged/jinja2" class="post-tag grid--cell" title="show questions tagged 'jinja2'" rel="tag">jinja2</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Feb 18 '11 at 11:07">asked Feb 18 '11 at 11:07</time> <a href="../../users/623001/shane" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/623001.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="shane" /> </a> <div class="s-user-card--info"> <a href="../../users/623001/shane" class="s-user-card--link">shane</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">1,025</li> <li class="s-award-bling s-award-bling__gold" title="2 gold badges">2</li> <li class="s-award-bling s-award-bling__silver" title="11 silver badges">11</li> <li class="s-award-bling s-award-bling__bronze" title="9 bronze badges">9</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-19141073"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>41</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>3</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/19141073/rendering-a-dictionary-in-jinja2" class="question-hyperlink">Rendering a dictionary in Jinja2</a></h3> <div class="excerpt">I'm playing with a url shortener (basing it on the Shortly demo app from Werkzeug). I have a dict like this - ('1', {'target': 'http://10.58.48.103:5000/', 'clicks': '1'}) ('3', {'target': 'http://slash.org', 'clicks': '4'}) ('2', {'target':…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/python" class="post-tag grid--cell" title="show questions tagged 'python'" rel="tag">python</a> <a href="../../questions/tagged/jinja2" class="post-tag grid--cell" title="show questions tagged 'jinja2'" rel="tag">jinja2</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Oct 02 '13 at 15:46">asked Oct 02 '13 at 15:46</time> <a href="../../users/2839288/user2839288" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/2839288.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="user2839288" /> </a> <div class="s-user-card--info"> <a href="../../users/2839288/user2839288" class="s-user-card--link">user2839288</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">577</li> <li class="s-award-bling s-award-bling__gold" title="1 gold badge">1</li> <li class="s-award-bling s-award-bling__silver" title="5 silver badge">5</li> <li class="s-award-bling s-award-bling__bronze" title="8 bronze badge">8</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="s-pagination pager fr"> <a class="s-pagination--item" href="../../questions/tagged/jinja2_page=6" rel="prev" title="Go to page 6">Prev </a> <a class="s-pagination--item" href="../../questions/tagged/jinja2_page=1" rel="" title="Go to page 1">1</a> <a class="s-pagination--item" href="../../questions/tagged/jinja2_page=2" rel="" title="Go to page 2">2</a> <a class="s-pagination--item" href="../../questions/tagged/jinja2_page=3" rel="" title="Go to page 3">3</a> <div class="s-pagination--item s-pagination--item__clear">…</div> <a class="s-pagination--item" href="../../questions/tagged/jinja2_page=99" rel="" title="Go to page 99">99</a> <a class="s-pagination--item" href="../../questions/tagged/jinja2_page=100" rel="" title="Go to page 100">100</a> <a class="s-pagination--item" href="../../questions/tagged/jinja2_page=8" rel="next" title="Go to page 8"> Next</a> </div> </div> </div> </div> </div> <script src="../../static/js/stack-icons.js"></script> <script src="../../static/js/fromnow.js"></script> </body> </html>