===================
test.py:
===================
import inspect
def track(func):
def wrapped(*args, **kwargs):
stack = [s[1:] for s in inspect.stack()[2:]] #
return func(*args, **kwargs)
return wrapped
import jinja2
jinja2.Environment.get_template =
track(jinja2.Environment.get_template)
from jinja2 import FileSystemLoader, Environment
env = Environment(loader=FileSystemLoader('.'))
print env.get_template('template.html').render()
===================
template.html
===================
{% include "include.html" %}
===================
include.html is empty, or may even not exist. Running this gives me
"IndexError: list index out of range" in inspect.py
This seems to be the most basic way to recreate the error, but
depending on the template contents, whether it extends a parent
template, what blocks it contains and in what order etc., the error
sometimes occurs, and other times not.
The wrapper-function with it's "inspect.stack()"-call is basically how
django-debug-toolbar does it's template logging.
I'm using the latest trunk (f30b734ef52b).
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---