Skip to content
Myr

Use more _get_default_module calls

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

authored by Armin Ronacher · committed by Armin Ronacher · parent 95d495a · Browse files · 2 files+8 added−5 removed
This commit

State

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

Diff stats

2 files+8 added−5 removed

  • other:+8 added−5 removed

2 files+8 added−5 removed

modified:jinja2/compiler.py+5 added-4 removed
969 unmodified lines
970 self.outdent()971 self.writeline('else:')972 self.indent()973974 loop = self.environment._async and 'async for' or 'for'975 if node.with_context:975 self.writeline('for event in template.root_render_func('976 self.writeline('%s event in template.root_render_func('977 'template.new_context(context.parent, True, '977 'locals())):')978 'locals())):' % loop)979 else:980 self.writeline('for event in template._get_default_module()'981 '._body_stream:')982
16 unmodified lines
999 self.write(', %r).' % self.name)1000 if node.with_context:1001 self.write('make_module(context.parent, True, locals())')1002 else:1002 self.write('module')1003 self.write('_get_default_module()')1004 if frame.toplevel and not node.target.startswith('_'):1005 self.writeline('context.exported_vars.discard(%r)' % node.target)1006 frame.assigned_names.add(node.target)1007
5 unmodified lines
1013 self.write(', %r).' % self.name)1014 if node.with_context:1015 self.write('make_module(context.parent, True)')1016 else:1016 self.write('module')1017 self.write('_get_default_module()')10181019 var_names = []1020 discarded_names = []1021 for name in node.names:
691 unmodified lines
modified:jinja2/environment.py+3 added-1 removed
1095 unmodified lines
1096 def __init__(self, template, context, body_stream=None):1097 if body_stream is None:1098 if context.environment._async:1099 raise RuntimeError('Async mode requires a body stream '1100 'to be passed in.')1100 'to be passed to a template module. Use '1101 'the async methods of the API you are '1102 'using.')1103 body_stream = list(template.root_render_func(context))1104 self._body_stream = body_stream1105 self.__dict__.update(context.get_exported())1106 self.__name__ = template.name
121 unmodified lines