Reputation: 1261
I've stumbled upon a problem with inheritence in Mako. I'll try to illustrate the problem below using two template files...
base.tpl - has a named block title:
<title><%block name="title"></%block></title>
foo.tpl - inherits from base.tpl and sets the title:
<%inherit file="base.tpl" />
<%block name="title">${title}</%block>
The template is rendered (using Bottle) with:
...
return mako_template('foo', title="My title")
Now I expected the output to be
<title>My title</title>
but instead it becomes:
<title><function render_title.<locals>.title at 0x0346A1E0></title>
Any clues? Using a different variable name than the block works.. but I'd like to use the same if possible!
Upvotes: 0
Views: 263
Reputation: 1261
Using this instead works:
<%block name="title">${context["title"]}</%block>
Does anyone know why?
Upvotes: 1