开发者

In mako template: call python function within html string

How do I do this in mako:

<% import开发者_如何学编程 cherrypy %>
...
<link rel="stylesheet" href="${cherrypy.url('/media/layout.css')}" type="text/css" />

AttributeError: 'Undefined' object has no attribute 'url'


Answer: Instead of <% import cherrypy %> one needs <%! import cherrypy %>

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜