I\'m really new to Pyramid (and pretty new to web frameworks in general).
I\'m trying to get to the stage where I can return raw HTML from a view, so that I can markup d
To prevent Chameleon from escaping the ${result}
variable, you need to use ${structure: result}
, as per the documentation: http://chameleon.readthedocs.org/en/latest/reference.html#structure
The string is being escaped, which is the default for strings inserted into templates to prevent naughty code being injected into your site. To mark the string as safe, you'll want to mark it as a literal so it's not escaped. I believe that pyramid (like pylons) ships with the webhelpers module, so you can import the literal function:
from webhelpers.html import literal
then replace your final results assignment with:
results = literal("<ul> %s </ul>" %results)
If literal doesn't ship with pyramid as I suspect, see this post: Python Pyramid & Chameleon templating language escapes html
edit: note that you should probably be escaping your data from your db before you input it into the html for safety's sake. You can use cgi.escape
for this.