When I use <%page/> and also inherit another template I can no longer overwrite the default args

28 views
Skip to first unread message

entwi...@gmail.com

unread,
May 30, 2016, 3:29:55 PM5/30/16
to Mako Templates for Python
I want <%page/> to set the default value of a variable, but if I also inherit another template I can't overwrite that variable anymore.



from mako.template import Template
from mako.lookup import TemplateLookup
 
lookup
= TemplateLookup()
lookup
.put_string("base.html", '-${self.body()}-')
 
t
= Template('<%page args="x=None"/>${x}')
t_inherits
= Template('<%inherit file="base.html"/><%page args="x=None"/>${x}', lookup=lookup)
 
 
print(t.render(x=9), t_inherits.render(x=9))
#9 -None-


Reply all
Reply to author
Forward
0 new messages