On Fri, Oct 2, 2009 at 10:14 AM, znafets <[email protected]> wrote:
>
> Funny enough I actually purchased the pdf from lulu and read it
> twice ... obviously once too less :)
> Thanks, but as described on page 113,114 the args=['x', 'y'] seems not
> to work. If you pass a list with one single element it works, multiple
> elements separated by comma do not.
>
not sure why you think it doesn't work; it should work just fine:
x = request.args[0]
y = request.args[1]
or, alternately
myargs = request.args
print len( myargs )
x = myargs[0]
y = myargs[1]
> SO I need something like this to retrieve the default values from db
> now:
> row=db(db.user.uname==request.args[0]).select()
> ^^^^^^^^^^^^^^
> right ?
>
suggest you save the request items of interest in a variable; also, get
accustomed to trying things like this out in a command line shell (if you
have ipython, it will be used, and you will at least have command completion
with the TAB key):
python web2py.py -S myapp -M
Now you can see what that kind of select will return, and work out what you
need in there.
- Yarko
>
> odd, the select statement seems to be not correct I am not too good
> with dbs either :)
>
> ciao
>
> Stefan
>
> On 2 Okt., 16:36, Yarko Tymciurak <[email protected]> wrote:
> > See section 4.2 in the manual for an explanation of the argument-URL
> > convention in web2py (P. 113;
> http://www.web2py.com/examples/default/docs)
> >
> > Note: If a controller function takes arguments, it is not exposed to
> views
> > (rather, just for server-side use); passing from view to controller is
> done
> > through request.args[], or request.vars. For example,
> >
> > ...
> > <td>{{=A(uname, _href=URL(r=request, f='edit_user',
> > args=[uname]))}}</td>
> > ...
> >
> > would be fetched as:
> >
> > ...
> > def edit_user():
> > uname = request.args[0]
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---