It is a bug in the book.
<form action="second">
should be
<form action="{{=URL('second')}}">
On Friday, 30 October 2015 23:04:30 UTC-5, Yibing Liu wrote:
>
> I am learning web2py. I found a redirect error between 2 very simple
> actions. This application which I simple modify from the web2py manual is
> just used to help me to understand the controlflow,request.args and
> request.vars of web2py. Here is the code in my default controller.
>
> def index():
> redirect(URL("first",args=1))
> def first():
> return dict()
> def second():
> return dict()
>
> Then I create the first.html and second.html
>
> first.html is
>
> <h1>What is your name?</h1><form action="second">
> <input name="visitor_name" />
> <input type="submit" /></form>
>
> second.html is
>
> <h1>Hello {{=request.vars.visitor_name}}</h1>
>
> I input something to the form in the first.html,but when I press the
> submit button it doesn't redirect to the "second" action. And I found
> something wrong in the url of the browser
> http://127.0.0.1:8000/welcome/default/first/second?visitor_name=zhangsan
>
> I am very confused and do many test. I change the code in the index
>
> from
>
> def index():
> redirect(URL("first",args=1))
>
>
> to
>
> def index():
> redirect(URL("first"))
>
> And the redirect make sense. I am vary confused about this. Is this a bug
> in web2py or I misunderstand the controlflow of web2py?
>
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.