Skip to content

Commit

Permalink
Should work for cpython and pypy now (if the latter is fixed)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Nov 29, 2010
1 parent 19a2374 commit 9e5d083
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions jinja2/debug.py
Expand Up @@ -39,17 +39,15 @@ def __init__(self, tb):
self.tb = tb self.tb = tb
self._tb_next = None self._tb_next = None


def _set_tb_next(self, next): @property
def tb_next(self):
return self._tb_next

def set_next(self, next):
if tb_set_next is not None: if tb_set_next is not None:
tb_set_next(self.tb, next and next.tb or None) tb_set_next(self.tb, next and next.tb or None)
self._tb_next = next self._tb_next = next


def _get_tb_next(self):
return self._tb_next

tb_next = property(_get_tb_next, _set_tb_next)
del _get_tb_next, _set_tb_next

@property @property
def is_jinja_frame(self): def is_jinja_frame(self):
return '__jinja_template__' in self.tb.tb_frame.f_globals return '__jinja_template__' in self.tb.tb_frame.f_globals
Expand Down Expand Up @@ -80,9 +78,9 @@ def __init__(self, exc_type, exc_value, frames):
prev_tb = None prev_tb = None
for tb in self.frames: for tb in self.frames:
if prev_tb is not None: if prev_tb is not None:
prev_tb._tb_next = tb prev_tb.set_next(tb)
prev_tb = tb prev_tb = tb
prev_tb._tb_next = None prev_tb.set_next(None)


def render_as_text(self, limit=None): def render_as_text(self, limit=None):
"""Return a string with the traceback.""" """Return a string with the traceback."""
Expand Down

0 comments on commit 9e5d083

Please sign in to comment.