python - Pass variable from called Mako template to inherited template -


i using cherrypy mako templates. trying work out how pass aruguments initial call (in example title):

class landing(object):     def index(self):         tmpl = lookup.get_template("index.html")         return tmpl.render(title="hello world")     index.exposed = true 

to index.html:

<%inherit file="base.html"/> <%def name="title()">$(title)</%def> body content 

and inherited base.html template:

<!doctype html>     <head>         <meta charset="utf-8">         <title>$(self.title())</title>     </head>     <body>         <h1>$(parent.title())</h1>         ${self.body()}     </body> </html> 

i've tried self.title , parent.title , neither work. how pass variable initial call?

in order use rendered variables - use them ${ title } not $( title )


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -