mako如何访问Windows下当前正在渲染的对象名称
我是 Mako 新手,对对象模型有疑问。
我们在 Windows 7 下通过 render 命令通过 mako 生成一个模板文件,类似于
out.write(self.objectname.render(...))
正在渲染的文件中,我想访问类似于以下伪代码的对象名...
<%namespace name="mapping" module="objtool.mapping" />
<%!
import os
import time
%>\
======================================================
== this file is being rendered from $(object.name)
======================================================
这可能吗?
注意:我可以让它生成类似于以下内容的输出
this file is being rendered from <mako.template.Template object at 0x02F48990>
,但我想要实际的对象名称
I am new to mako, and have a question about the object model.
We are generating a template file via mako under Windows 7 through the render command, similar to
out.write(self.objectname.render(...))
within the file being rendered, I want to access the objectname similar to the following pseudo code ...
<%namespace name="mapping" module="objtool.mapping" />
<%!
import os
import time
%>\
======================================================
== this file is being rendered from $(object.name)
======================================================
Is this even possible?
Note: I can get it to generate output similar to the following
this file is being rendered from <mako.template.Template object at 0x02F48990>
but I want the actual object name
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
渲染
renders