Hi,

Our develpment team were previously using web2py version 1.94.6 and
recently updated to the version 1.97.1. We noticed a significant
difference in functionality when including a view that extend another
view. We considered this to be a bug and decided to report it here.

Let's say we have a controller and a function in it. The function uses
a view template named 'alpha.html'. The view contains the following
piece of code:

<h1>Alpha page</h1>
{{include 'beta.html'}}

As you can see, the view includes a view called 'beta.html' to it. Let
the 'beta.html' have this code in it:

{{extend 'gamma.html'}}
<p>This is paragraph is from beta.</p>

This view extends a third view called 'gamma.html'. Let it have this
code:

<p>This paragraph is from gamma.</p>
{{include}}

What you would expect as a result when rendering 'alpha.html' (and
what the previous web2py version actually procuded) is the following
page:

<h1>Alpha page</h1>
<p>This paragraph is from gamma.</p>
<p>This is paragraph is from beta.</p>

What we get instead, in the new version, is just this:

<h1>Alpha page</h1>
<p>This paragraph is from gamma.</p>

The content rendered in 'beta.html' is left out, which is quite
surprising. There are no errors, the template code is just not run.
This issue can actually be avoided by replacing the {{include
'beta.html'}} tag with the following tag:

{{response.write(response.render('beta.html', dict()), escape=False)}}

However, this solution hides any possible errors raised in 'beta.html'
by wrapping them in a RestrictedError. Also, the include-tag would be
much more elegant. Our project, due to its complexity, has a need for
a possibility to include views that extend other views.

Reply via email to