我有以下base.html文件,它充当继承它的所有其他文件的主要框架。
<%! import cherrypy %>
<!DOCTYPE html>
<html>
<body>
<div class="container">
<% attribute='defaultValue' %>
${attribute}
<p>
${self.body()}
</p>
</div>
</body>
</html>
现在我有另一个文件继承了base.html,让我们命名它foo.html:
<%inherit file="base.html" />
Whatever... ${anotherAttribute}
html 文件将在 Python 文件中调用,文件名为lookup.get_template('foo.html').
我可以anotherAttribute使用lookup.get_template('foo.html').render(anotherAttribute='bar'). 现在我想知道如何访问attributein base.html?