Skip to content
Myr

Fixed a confusing edge case (thanks apollo13)

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 57c9b6d · Browse files · 3 files+18 added−7 removed
This commit

State

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

Diff stats

3 files+18 added−7 removed

  • other:+18 added−7 removed

3 files+18 added−7 removed

modified:jinja2/compiler.py+3 added-3 removed
1049 unmodified lines
1050 self.visit(node.node, frame)10511052 def visit_Output(self, node, frame):1053 # if we have a known extends statement, we don't output anything1054 if self.has_known_extends and frame.toplevel:1054 if self.has_known_extends and frame.block is None:1055 return10561057 if self.environment.finalize:1058 finalize = lambda x: unicode(self.environment.finalize(x))
1 unmodified line
1060 finalize = unicode10611062 self.newline(node)10631064 # if we are in the toplevel scope and there was already an extends1064 # if we are not in a block and there was already an extends1065 # statement we have to add a check that disables our yield(s) here1066 # so that they don't appear in the output.1067 outdent_later = False1068 if frame.toplevel and self.extends_so_far != 0:1068 if frame.block is None and self.extends_so_far != 0:1069 self.writeline('if parent_template is None:')1070 self.indent()1071 outdent_later = True1072
347 unmodified lines
modified:jinja2/ext.py+7 added-4 removed
140 unmodified lines
141 extract_translations=self._extract142 )143144 def _install(self, translations):145 self.environment.globals.update(146 gettext=translations.ugettext,147 ngettext=translations.ungettext148 )145 gettext = getattr(translations, 'ugettext', None)146 if gettext is None:147 gettext = translations.gettext148 ngettext = getattr(translations, 'ungettext', None)149 if ngettext is None:150 ngettext = translations.ngettext151 self.environment.globals.update(gettext=gettext, ngettext=ngettext)152153 def _install_null(self):154 self.environment.globals.update(155 gettext=lambda x: x,
300 unmodified lines
modified:CHANGES+8 added
16 unmodified lines
17- index based subscribing of variables with a constant value returns an18 undefined object now instead of raising an index error. This was a bug19 caused by eager optimizing.2021- the i18n extension looks up `foo.ugettext` now followed by `foo.gettext`22 if an translations object is installed. This makes dealing with custom23 translations classes easier.2425- fixed a confusing behavior with conditional extending. loops were partially26 executed under some conditions even though they were not part of a visible27 area.2829Version 2.030-----------31(codename jinjavitus, released on July 17th 2008)32
32 unmodified lines