{{include ...}} is not Python code but a web2py template language
directive, so it is processed *before* any Python is processed. So, the
content of site/calendar.html will be included in the parsed template no
matter what. However, that content will still end up inside an "if" block,
so should only be rendered if the "if" condition is true. Are you saying it
is getting rendered even when the "if" condition is False?
Anthony
On Friday, July 6, 2012 3:17:46 AM UTC-4, Annet wrote:
>
> In a view I have the following code:
>
> <div class="span4 box box-pad radius-small">
> {{if session.cal.lesrooster or session.cal.event_list or
> session.cal.cursusrooster:}}
> {{include 'site/calendar.html'}}
> {{pass}}
> {{include 'site/promoUnit.html'}}
> </div> <!-- /span -->
>
> Despite session.cal.lesrooster, session.cal.event_list and
> session.cal.cursusrooster being False, site/calendar.html is being
> included. When I replace {{include 'site/calendar.html'}} with <p>text</p>
> the text isn't displayed.
>
> When I move the condition to site/calendar.html, the behaviour is the
> same, only when I have the condition both in the view and in
> site/calendar.html the page is rendered correctly.
>
> site/index.html:
>
> <div class="span4 box box-pad radius-small">
> {{if session.cal.lesrooster or session.cal.event_list or
> session.cal.cursusrooster:}}
> {{include 'site/calendar.html'}}
> {{pass}}
> {{include 'site/promoUnit.html'}}
> </div> <!-- /span -->
>
> site/calendar.html:
>
> {{if (session.cal.lesrooster or session.cal.event_list or
> session.cal.cursusrooster):}}
> <ul class="nav nav-tabs">
> ...
> </ul>
>
> <div class="tab-content">
> ...
> </div> <!-- /tab-content -->
>
> <script type="text/javascript">
> ...
> </script>
> {{pass}}
>
>
> Is there an explanation for this behaviour?
>
>
> Kind regards,
>
> Annet
>
>
>
>