I am new to Jinja2 and I seem to be having problems to understand how
template inheritance works. I have a page with a main menu. The menu
is a python object, which generates menu markup.

Now the menu should be displayed on every single page - therefore,
should be a part of the base template. Each page content should be a
child template, which extends the base. I believe I got this right,
or?

Now the problem:
How do I pass the menu object to the base template context? I tried to
do this by getting the base template from the environment first,
passing the menu object to the globals of base, passing the base to
the context of page and then rendering the page.

This does not work. The base template is rendered without the menu. I
tried rendering the base separately and the menu object is rendered
with it.

I tried to provide the menu object through environment globals and
it's the only way which works for me - but somehow, it does not feel
right. Why are base template's globals not working? Is there any other
way, more appropriate way, to pass variables to the base template? I
guess it's me again doing something wrong.

I would be very thankful for someone's insight.

Mark

-- 
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" 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/pocoo-libs?hl=en.

Reply via email to