Skip to content
Myr

[svn] added everytime block handling

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent 34f3042 · Browse files · 1 file+24 added−25 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+24 added−25 removed

  • other:+24 added−25 removed

1 file+24 added−25 removed

modified:jinja/translators/python.py+24 added-25 removed
350 unmodified lines
351 lines.extend(body_lines)352 lines.append(' if False:\n yield None')353354 # add the missing blocks355 if blocks:356 block_items = blocks.items()357 block_items.sort()358 dict_lines = []359 for name, items in block_items:360 tmp = []361 for idx, item in enumerate(items):362 # ensure that the indention is correct363 self.indention = 1364 func_name = 'block_%s_%s' % (name, idx)365 lines.extend([366 '\ndef %s(context):' % func_name,367 ' ctx_push = context.push',368 ' ctx_pop = context.pop',369 ' if False:',370 ' yield None'371 ])372 lines.append(self.indent(self.nodeinfo(item, True)))373 lines.append(self.handle_block(item, idx + 1))374 tmp.append('buffereater(%s)' % func_name)375 dict_lines.append(' %r: %s' % (376 str(name),377 _to_tuple(tmp)378 ))379 lines.append('\nblocks = {\n%s\n}' % ',\n'.join(dict_lines))355 block_items = blocks.items()356 block_items.sort()357 dict_lines = []358 for name, items in block_items:359 tmp = []360 for idx, item in enumerate(items):361 # ensure that the indention is correct362 self.indention = 1363 func_name = 'block_%s_%s' % (name, idx)364 lines.extend([365 '\ndef %s(context):' % func_name,366 ' ctx_push = context.push',367 ' ctx_pop = context.pop',368 ' if False:',369 ' yield None'370 ])371 lines.append(self.indent(self.nodeinfo(item, True)))372 lines.append(self.handle_block(item, idx + 1))373 tmp.append('buffereater(%s)' % func_name)374 dict_lines.append(' %r: %s' % (375 str(name),376 _to_tuple(tmp)377 ))378 lines.append('\nblocks = {\n%s\n}' % ',\n'.join(dict_lines))379380 # now get the real source lines and map the debugging symbols381 debug_mapping = []382 last = None
549 unmodified lines