开发者

How can mako access the object name currently being rendered under Windows

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)
===============================================开发者_JAVA技巧=======

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


<%namespace name="mapping" module="objtool.mapping" />
<%!
import os
import time
%>\
======================================================
== this file is being rendered from ${os.path.basename(self.name)}
======================================================

renders

======================================================
== this file is being rendered from poco_custom.cs
======================================================
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜