On Fri, Oct 2, 2009 at 1:35 PM, znafets <[email protected]> wrote:

>
> Thanks for the hint, vars seems definetly the better choice.
> But the db part drives me to desperation:
> doing in controller:
>
>    uname=request.vars.uname
>    query=db(db.user.name==uname)
>

should be:

       query = db.user.name==uname

you really need to download / install ipython first (
http://ipython.scipy.org), and get used to trying your expressions in a
shell to see what they return:

     python web2py.py -S myapp -M

>>> uname="Mytest"
>>> query= db.user.name==uname

etc.

The problems you are having are basic programing things (not even so much
python), so you might want to get something like wingIDE (there is a 30 day
trial that is given out in 10-day chunks, so prepare and use like the
dickens for 10 days at a stretch,  single step a LOT and observe local
variables and their values as you go -  then digest what you've learned) -
www.wingware.com


>    records=db(query).select()
>
> the select statement already throws up an exception (key error key
> (gluon)) or so
>
> seems I won't discover my secret love to database programming
> anymore :)
>
> ciao
> Stefan
>
> On 2 Okt., 19:48, mdipierro <[email protected]> wrote:
> > Mind that URLs are validate on input and if uname contains spaces
> > things will not work because spaces will be replace by _. I suggest:
> >
> >   <td>{{=A(uname, _href=URL(r=request, f='edit_user',vars=dict
> > (uname=uname)))}}</td>
> >
> > and in edit_user
> >
> > rows=db(db.....==request.vars.uname).select()
> >
> > On Oct 2, 12:42 pm, znafets <[email protected]> wrote:
> >
> > > Nah, don't worry, I'll figure that out somehow. Can't ask that much of
> > > you.
> >
> > > Thank you very much for the offer though. I am a web2py rookie (just
> > > started), never used django or alike.
> >
> > > So thanks again
> >
> > > ciao
> > > Stefan
> >
> > > On 2 Okt., 19:22, Yarko Tymciurak <[email protected]> wrote:
> >
> > > > If no one else can help you, I'll put together an example for you
> tonight
> > > > (tied up this afternoon)
> >
> > > > On Fri, Oct 2, 2009 at 12:07 PM, znafets <[email protected]>
> wrote:
> >
> > > > > >     not sure why you think it doesn't work; it should work just
> fine:
> >
> > > > > >     x = request.args[0]
> > > > > >     y = request.args[1]
> >
> > > > > well, as soon as I try something like args=[uname, uloc] in the
> view
> > > > > it comes up with "Invalid request".
> > > > > args=[uname] works just fine and can be retrieved via
> request.args[0]
> >
> > > > > working on linux (ubuntu karmic), python 2.5, web2py 1.67x
> >
> > > > > > > row=db(db.user.uname==request.args[0]).select()
> >
> > > > > can you give me a hand on this ? Trying to take the value which
> comes
> > > > > back from the view (username) and can be retrieved form
> request.args
> > > > > [0] and get the according record with all the it's fields to
> iterate
> > > > > through it.
> > > > > If it's not asked too much.
> >
> > > > > best regards
> > > > > Stefan
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to