The controller is executed fully every time the page is requested by the 
browser. The output is passed to the view which is also rendered every time 
the page is requested. No execution is ever paused by the server.

The first time .accpets() is false. When you submit the form, .accepts() is 
true. The second time it acts on a new form object, not the same as the 
previous form object. The form object is re-created at every request. They 
just look identical.

Mind that today we prefer form.process() instead of form.accepts(request, 
session)




On Saturday, 6 August 2016 01:59:34 UTC-5, Scott ODonnell wrote:
>
> I'm trying to understand the relationship between controllers and views 
> and the general flow of code.
>
> Per the documentation , the display_form() function will run and then feed 
> the "view" with the dict(form=form)
> At that point the view "default/display_form.html" would be processed and 
> sent to the client browser to be rendered.
>
> Questions :
> 1.) Unless the display_form() is run again after the form is returned to 
> the client browser , how would "if form.accepts(request,session) ever be 
> executed?
> 1a.) Is execution of the display_form() function paused while the 
> {{=form}} is executed?
>
> 2.)  Given "the default/display_form.html" , what logic prevents all the 
> content after {{=form}} from being sent to the client browser ?
> 2a.) What logic prevents the <h2> for "submitted variables", "Accepted 
> Variables" and "Errors in form" from being sent immediately while 
> processing the view html file?
>
>
> Thank you in advance for helping me understand this. I'm sure I'm just 
> thinking about it all incorrectly.
> -Scott
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to