Well, I did a bit of patching to get jinja2 to behave as I would
expect. I'm new to the code so I'm not overly confident that my patch
is the ideal way to handle this, but it's working fine so far.
Any input would be greatly appreciated.
Here is the patch (against the current tip: c78f8c799730):
*** compiler.py.orig 2008-09-30 08:34:52.000000000 -0700
--- compiler.py 2008-09-30 08:35:08.000000000 -0700
***************
*** 806,812 ****
self.visit(node.template, frame)
self.write(', %r)' % self.name)
self.writeline('for event in template.root_render_func('
! 'template.new_context(context.parent,
True)):')
else:
self.writeline('for event in environment.get_template(',
node)
self.visit(node.template, frame)
--- 806,812 ----
self.visit(node.template, frame)
self.write(', %r)' % self.name)
self.writeline('for event in template.root_render_func('
! 'template.new_context(context, True)):')
else:
self.writeline('for event in environment.get_template(',
node)
self.visit(node.template, frame)
***************
*** 982,987 ****
--- 982,990 ----
self.outdent(2)
self.indent()
+ self.writeline(
+ 'context.vars[%r] = l_%s' % (node.target.name,
node.target.name)
+ )
self.blockvisit(node.body, loop_frame)
if node.else_:
self.writeline('%s = 0' % iteration_indicator)
***************
*** 1182,1187 ****
--- 1185,1193 ----
assignment_frame.assigned_names = set()
else:
assignment_frame = frame
+ self.write('context.vars[%r] = ' % node.target.name)
+ self.visit(node.node, frame)
+ self.writeline('')
self.visit(node.target, assignment_frame)
self.write(' = ')
self.visit(node.node, frame)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---