lines.append(self.handle_node(n))
# the template body
- rv = self.handle_node_list(node)
+ body_lines = [self.handle_node(n) for n in node]
+ print list(node)
# add translation helpers if required
if self.require_translations:
' return translator.gettext(s) % (r or {})\n'
' return translator.ngettext(s, p, r[n]) % (r or {})'
)
- lines.append(rv)
+ lines.extend(body_lines)
lines.append(' if False:\n yield None')
return '\n'.join(lines)
"""
rv = self.handle_node(node.body)
if not rv:
- return
+ return ''
buf = []
write = lambda x: buf.append(self.indent(x))
Raise an exception "in a template". Return a traceback
object.
"""
+ # some traceback systems allow to skip blocks
+ __traceback_hide__ = True
+
offset = '\n' * (lineno - 1)
code = compile(offset + 'raise __exception_to_raise__', filename, 'exec')
namespace = context.to_dict()
def clear(self):
self._mapping.clear()
- del self._queue[:]
+ try:
+ self._queue.clear()
+ except AttributeError:
+ del self._queue[:]
def __contains__(self, key):
return key in self._mapping