the line redirect(URL('second')) produces an error in URL.

What version of web2py are you using?

Writing redirect((URL('second')) works very well, atleast with 1.91.6.


Kenneth


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 <mailto: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

    deffirst():
         ifrequest  
<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'))

         returndict()

    defsecond():

         returndict()


      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",line446,inwsgibase

         serve_controller(request,response,session)

       
File"C:\Python25\Lib\site-packages\web2py\gluon\main.py",line186,inserve_controller

         page=run_controller_in(request.controller,request.function,environment)

       
File"C:\Python25\Lib\site-packages\web2py\gluon\compileapp.py",line407,inrun_controller_in

         restricted(code,environment,filename)

       
File"C:\Python25\Lib\site-packages\web2py\gluon\restricted.py",line188,inrestricted

         execccodeinenvironment

       
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>,line68,in<module>

       
File"C:\Python25\Lib\site-packages\web2py\gluon\globals.py",line95,in<lambda>

         self._caller=lambdaf: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>,line17,infirst

         redirect(URL(r=request,f='second'))

       
File"C:\Python25\Lib\site-packages\web2py\gluon\http.py",line104,inredirect

         Location=location)

    HTTP




    Any thoughts?




Reply via email to