You should know the different between 'next' and 'self' in mako world. next means the next template in the chain of template. self will call the lastest template in the chain.
So in your circumstance: ## base.html next ## layout.html **next ## index.html *** Just render layout.html must get an error because layout.html don't have the next template in chain. Although I think the things you want to do its a design problem, solve this one the simple solution is ## base.html next ## layout.html **self ## index.html ***** On 2月23日, 上午9时54分, Anil <[email protected]> wrote: > Here is an example I have: > > ## base.html > <html> > <body> > ${next.body()} > </body> > </html> > > ## layout.html > <%inherit file="base.html"/> > <div class="mainlayout"> > ${next.body()} > </div> > > ## index.html > <%inherit file="layout.html"/> > ## .. rest of template > > Of course, rendering index.html will inherit the other two files > (base.html and layout.html) but is it possible to just render say > layout.html only? When I do that, I get: > > AttributeError: 'builtin_function_or_method' object has no attribute 'body' > > Which makes sense, but am wondering if there is a better way to write > this code. > > Thanks -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
