I know this is really basic but I dont understand. Can somebody please
explain what is happening in the excerpt below. I am doing chapter 3
of the documentation found here:
http://www.web2py.com/book/default/chapter/03#Postbacks
Here is my general understanding:
1) It appears that we are returning an empty dictionary which
typically should contain a message to be passed through to a view. But
none is provided.
2) Is a layout with a form that directs to the controller "second"
that returns an empty dictionary.
3) here we have a variable in head 1 that contains
"=request.vars.visitor_name" in the second view. The doc does explain
what request is or does as well as vars. So:
What is request and its function? What is vars and its function? What
do the dots in between them mean or do? How does "visitor_name" get
passed through to the second view without being passed through one of
the default controllers?
Here is the excerpt:
1) Write the corresponding actions in the default controller:
def first():
return dict()
def second():
return dict()
2) Then create a view "default/first.html" for the first action:
{{extend 'layout.html'}}
What is your name?
<form action="second">
<input name="visitor_name" />
<input type="submit" />
</form>
3) Finally, create a view "default/second.html" for the second action:
{{extend 'layout.html'}}
<h1>Hello {{=request.vars.visitor_name}}</h1>
Thank you very much. I am beginner who just switched over from Django
after hearing so many good things about the community and framework.