>
> So whatever Python code inside {{}} will be executed, irrespective of the
> link is clicked or not.
>
Note, the Python code is not sent to the browser. When a web2py URL is
requested, before returning a response to the browser, web2py executes the
template on the server. At that time, all the Python code in the template
is executed with the purpose of generating the HTML to send to the browser.
The purpose of the Python code in the template should be to generate the
HTML for the page. If you happen to call redirect() within the template,
you'll get an actual redirect right then -- the rest of the HTML will not
be generated, and the request will be aborted.
Anthony