I ran into another snag in extracting and rendering a single block in
jinja. It looks like the parent template's context is not available.
How would I make it available?
Here is an example:
parent.html: """
<html>
<body>
{% set base_url='http://server/something' %}
{% block page %}
{% endblock %}
</body>
<html>
"""
child.html: """
{% extends "parent.html" %}
{% block page %}
<a href="{{ base_url }}">foo</a>
{% endblock %}
"""
In pulling out 'page' from template.blocks and executing it to render
the block, is there a way to get access to base_url as if you'd
rendered the whole template? Here is the current code I'm using to
extract and render the block:
https://github.com/kumar303/zamboni/commit/52ac2979573a937638c2ac0dfd2fd7eb7924631f#L1R60
I tried calling template.module and variations of
template.make_module() in the hope that it would execute the parent
block and pass along the context but I couldn't get anything to work.
Any ideas?
thanks, Kumar
--
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.