second function is maybe leave empty, then you just have to imagine what
ever you want??

Richard

On Sun, Jan 16, 2011 at 1:14 AM, KK <kkuo...@gmail.com> wrote:

> Hello,
>
> I'm attempting to learn web2py and I think there is an error in the book.
> http://web2py.com/book/default/chapter/03
>
> def first():
>     if request 
> <http://web2py.com/book/default/docstring/request>.vars.visitor_name:
>         session 
> <http://web2py.com/book/default/docstring/session>.visitor_name = request 
> <http://web2py.com/book/default/docstring/request>.vars.visitor_name
>         redirect <http://web2py.com/book/default/docstring/redirect>(URL 
> <http://web2py.com/book/default/docstring/URL>('second'))
>     return dict()
>
> def second():
>     return dict()
>
>
> the line redirect(URL('second')) produces an error in URL.  I change the code 
> to URL(r=request, f='second') but then it raised an exception, seems like in 
> restricted.
>
>
> raceback (most recent call last):
>   File "C:\Python25\Lib\site-packages\web2py\gluon\main.py", line 446, in 
> wsgibase
>     serve_controller(request, response, session)
>   File "C:\Python25\Lib\site-packages\web2py\gluon\main.py", line 186, in 
> serve_controller
>     page = run_controller_in(request.controller, request.function, 
> environment)
>   File "C:\Python25\Lib\site-packages\web2py\gluon\compileapp.py", line 407, 
> in run_controller_in
>     restricted(code, environment, filename)
>   File "C:\Python25\Lib\site-packages\web2py\gluon\restricted.py", line 188, 
> in restricted
>     exec ccode in environment
>   File 
> "C:/Python25/Lib/site-packages/web2py/applications/welcome/controllers/default.py"
>  <http://127.0.0.1:8080/admin/default/edit/welcome/controllers/default.py>, 
> line 68, in <module>
>   File "C:\Python25\Lib\site-packages\web2py\gluon\globals.py", line 95, in 
> <lambda>
>     self._caller = lambda f: f()
>   File 
> "C:/Python25/Lib/site-packages/web2py/applications/welcome/controllers/default.py"
>  <http://127.0.0.1:8080/admin/default/edit/welcome/controllers/default.py>, 
> line 17, in first
>     redirect(URL(r=request, f='second'))
>   File "C:\Python25\Lib\site-packages\web2py\gluon\http.py", line 104, in 
> redirect
>     Location=location)
> HTTP
>
>
> Any thoughts?
>
>

Reply via email to