On Aug 11, 2010, at 6:05 AM, Hector Oron wrote:
> Hello,
>
> Following the example on Chapter 3 [1] about Form self-submission, I
> get Internal Error after visiting first and introducing the name,
> getting the following traceback:
What version of web2py are you running?
If you're not running something fairly current, try adding r=request to your
URL() calls (it won't do any harm in later versions, but shouldn't be
necessary).
>
> Traceback (most recent call last):
> File "/home/zumbi/TCL/SRC_test/web2py/gluon/restricted.py", line
> 178, in restricted
> exec ccode in environment
> File
> "/home/zumbi/TCL/SRC_test/web2py/applications/mytcl/controllers/default.py",
> line 22, in <module>
> File "/home/zumbi/TCL/SRC_test/web2py/gluon/globals.py", line 96, in <lambda>
> self._caller = lambda f: f()
> File
> "/home/zumbi/TCL/SRC_test/web2py/applications/mytcl/controllers/default.py",
> line 14, in first
> redirect(URL('second'))
> File "/home/zumbi/TCL/SRC_test/web2py/gluon/html.py", line 182, in URL
> raise SyntaxError, 'not enough information to build the url'
> SyntaxError: not enough information to build the url
>
>
> # -*- coding: utf-8 -*-
>
> #########################################################################
> ## This is a samples controller
> ## - index is the default action of any application
> ## - user is required for authentication and authorization
> ## - download is for downloading files uploaded in the db (does streaming)
> ## - call exposes all registered services (none by default)
> #########################################################################
>
> def first():
> if request.vars.visitor_name:
> session.visitor_name = request.vars.visitor_name
> redirect(URL('second'))
> return dict()
>
> def second():
> if not request.function=='first' and not session.visitor_name:
> redirect(URL('first'))
> return dict()
>
> response._vars=response._caller(first)
> ^^^-- This line does not exist on my controller code.
>
>
>
> controllers/default.py:
> def first():
> if request.vars.visitor_name:
> session.visitor_name = request.vars.visitor_name
> redirect(URL('second'))
> return dict()
>
> def second():
> if not request.function=='first' and not session.visitor_name:
> redirect(URL('first'))
> return dict()
>
> default/first:
> {{extend 'layout.html'}}
> What is your name?
> <form>
> <input name="visitor_name" />
> <input type="submit" />
> </form>
>
> default/second:
> {{extend 'layout.html'}}
> <h1>Hello {{=session.visitor_name or "anonymous"}}</h1>
>
> [1] http://web2py.com/book/default/chapter/03
>
> Cheers,
> --
> Héctor Orón
>
> "Our Sun unleashes tremendous flares expelling hot gas into the Solar
> System, which one day will disconnect us."
>
> -- Day DVB-T stop working nicely
> Video flare: http://antwrp.gsfc.nasa.gov/apod/ap100510.html