correct

On Mar 9, 5:14 pm, ron_m <ron.mco...@gmail.com> wrote:
> I use this in a portion of the views coded for what I am working on and it
> works for me. I just ran the page with the test true and again with the test
> false and I get the include file content inside the {{if condition:}} branch
> if the condition is True and the html in the {{else:} branch if the
> condition is False. I verified with a View Source in the browser, the code
> from the include file is not there when the condition is False. I am on
> 1.93.2 but this has been consistent for several months now.
>
> Here is a chunk of code
>
> {{site_names =  session.user_access['site_names']}}
> {{if len(site_names) > 1:}}
>     {{include 'common/site_switcher.html'}}
>     <hr />
> {{else:}}
>     {{=B(header)}}
>     {{pass}}
> {{include 'live/display_mode_switcher.html'}}
> <hr/>
>
> I think the include is indeed expanded out unconditionally but when the
> Python logic runs the response.write is not executed for that portion of the
> code if condition is False.
>
> Replace someData in your example with True and then with False and refresh
> the page to see what you get in each case. The truthness or falseness of a
> variable can be deceiving. Also the include file name should be the path
> portion past views.

Reply via email to