tauran
tauran

Reputation: 8036

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'

Upvotes: 2

Views: 1687

Answers (1)

tauran
tauran

Reputation: 8036

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

Upvotes: 3

Related Questions