Skip to content
Myr

Stop use of .module in generated code

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 7c90534 · 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+1 added-1 removed
974 unmodified lines
975 self.writeline('for event in template.root_render_func('976 'template.new_context(context.parent, True, '977 'locals())):')978 else:979 self.writeline('for event in template.module._body_stream:')979 self.writeline('for event in template._get_default_module()._body_stream:')980981 self.indent()982 self.simple_write('event', frame)983 self.outdent()
727 unmodified lines
modified:jinja2/environment.py+7 added-4 removed
1033 unmodified lines
1034 as for the :meth:`new_context` method.1035 """1036 return TemplateModule(self, self.new_context(vars, shared, locals))10371038 def _get_default_module(self):1039 if self._module is not None:1040 return self._module1041 self._module = rv = self.make_module()1042 return rv10431044 @property1045 def module(self):1046 """The template as module. This is used for imports in the1047 template runtime but is also useful if one wants to access
4 unmodified lines
1052 '23'1053 >>> t.module.foo() == u'42'1054 True1055 """1050 if self._module is not None:1051 return self._module1052 self._module = rv = self.make_module()1053 return rv1056 return self._get_default_module()10571058 def get_corresponding_lineno(self, lineno):1059 """Return the source line number of a line number in the1060 generated bytecode as they are not in sync.
159 unmodified lines