【发布时间】:2011-07-28 11:48:37
【问题描述】:
我阅读了 Makotemplate 的手册并看到以下代码:
from mako.template import Template
from mako.runtime import Context
from StringIO import StringIO
mytemplate = Template("hello, ${name}!")
buf = StringIO()
ctx = Context(buf, name="jack")
mytemplate.render_context(ctx)
print buf.getvalue()
使用上下文有什么好处?
【问题讨论】: