title: Decoding HTML Entities using Bottle for Python
body: <p>So basically I am writing a web application using <a href="http://bottlepy.org/" rel="nofollow" title="bottle">Bottle</a> for Python. But I have run into a very weird and frustrating bug: Whenever I try to put any HTML code via the code, it converts them to HTML entities. Here, its better I let the code explain:</p>
  
  <pre><code>def fillFlist():
      files = os.listdir('Files/FS/')
      tFlist = []
      for item in files:
          tFlist.append('&lt;tr&gt;&lt;td&gt;')
          tFlist.append(item)
          tFlist.append('&lt;/td&gt;&lt;td&gt;')
          tFlist.append('&lt;a href="localhost/delete/' + item + '"&gt;Delete&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;')
      tempO = ''
      tempI = tempO.join(tFlist)
      print(tempI)
      return tempI
  </code></pre>
  
  <p>That there is basically a system that will loop through the files and create a table row for each file, and also add a link to delete the file. Then you can see the joining the table to make one string, and then this string would be inserted into the HTML to create a table, but instead of a nice table, I end up with this:</p>
  
  <pre><code>&lt;tr&gt;&lt;td&gt;test.txt&lt;/td&gt;&lt;td&gt;&lt;a href="localhost/delete/hello.txt"&gt;Delete&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>Straight and raw on the page. I have googled forever trying to figure this problem out, but have yielded nothing. Some additional notes to help you out:</p>
  
  <pre><code>Cookie = request.get_cookie('uploaded')
  Flist = fillFlist()
  
  return template(loadHTML('index.html'), flist=Flist, cookie=Cookie)
  </code></pre>
  
  <p>This is basically is whats meant to insert the table into the HTML file, by doing this:</p>
  
  <pre><code>{{flist}}
  </code></pre>
  
  <p>And basically, I put that anywhere in the HTML code, and the template above requires a string to put in its place, and so whenever the page is loaded, whatever is in that string, is placed where ever the {{varname}} is.</p>
  
  <p>Good Luck and Thankyou in advance!</p>
  
  <p>Edit 1:</p>
  
  <p>I have also found out that it is not being converted in my code at all, so it gets converted right as its put on the web page? I don't know, and I guess, that's why i'm here.</p>
  
  <p>Edit 2:</p>
  
  <p>Well I fixed the problem, turns out when I parse lines of HTML code through to the web page (using the {{varname}} method), it converts the special characters into entities. So after a whole day slaving over the keyboard, trying different methods, I fixed this using some basic file I/O and some iFrames. But thankyou for the response guys! It's good to see that stackoverflow is very quick to respond!</p>