Created
May 23, 2009 01:15
-
-
Save showyou/116454 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from mako.template import Template | |
>>> mytemplate = Template(filename="main.mako") | |
>>> ms = { "messages": [ {"name":"hoge","content":"foo"}]} | |
>>> ms | |
{'messages': [{'content': 'foo', 'name': 'hoge'}]} | |
>>> print mytemplate.render(**ms) | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 //EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html> | |
<head> | |
<title>Sample HTML</title> | |
</head> | |
<body> | |
<h1>Sample</h1> | |
<hr /> | |
<div class="content"> | |
<div class ="message"> | |
<span class="message_header">hoge</span> | |
<span class="message_body">foo</span> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment