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 %>
精彩评论