Thank you very much Anthony, as always for your very detailed explanations.
Made it really clear for me.
So the web2py goes through the .html lines and parses them and when it
encounters a code within {{}} it executes it. In the case of just
{{=URL('func')}} is converts that to a text with an address of that module.
On Friday, May 4, 2012 1:11:37 PM UTC+9, Anthony wrote:
>
> 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
>