How to modify a pyramid template on the fly before rendering

时间:2016-04-25 09:04:04

标签: python-2.7 web-applications pyramid

please I am working on a site where I would scrap another website's html table source code and append it to my template before rendering my page. I have written the script which stores the html code in a variable but don't know how to appendix it. Kindly suggest.

2 个答案:

答案 0 :(得分:0)

如果你正在使用jinja,试试这个:

<div class="html-content">{{scraped_html|safe}}</div>

答案 1 :(得分:0)

以下是变色龙模板系统的代码。 HTML是包含传递给模板的html代码的变量。

<div>${structure: HTML}</div>

或者我相信这也会起作用

<div tal:content="HTML"></div>