Goal: To access myargs in both base and child templates. Currently I can only access them in one or the other.
Call:
child.render(myargs={'a':2, b:'5'})
Base excerpt:
<%page args="myargs=None, **kwargs"/>
% if myargs['a']:
a is: ${myargs['a']}
% endif
${self.body(myargs=myargs)}
Child excerpt version 1:
<%page args="myargs=None, **kwargs"/>
<%inherit file="/base.html" />
% if myargs['b']:
b is: ${myargs['b']}
% endif
Child excerpt version 2:
<%page args="myargs=None, **kwargs"/>
<%inherit file="/base.html" />
<%def name="body()">
% if myargs['b']:
b is: ${myargs['b']}
% endif
</%def>
Using child version 1, child throws error because myargs is undefined, and base works. Using child version 2, base throws error because myargs is undefined, and child works.
These are not exact examples, but it's the essence of my dilemma. If someone can explain how to pass variables through the inheritance chain that would be lovely. Unfortunately the documentation for Mako seems to skip this section.
Nice easy solution lol.
It turns out "page args" are not useful for this cause, in fact they were creating the problem by overwriting "myargs" with "None" on one of the pages. Keyword variables can be accessed directly from both files without using "page args".