Re: [web2py] Problem trying to get a value from a rows object

2012-08-22 Thread Christian Espinoza
Excellent! Thanks a lot Anthony and Massimo. It´s save my day, now all is working using request.get_vars.id instead of request.vars.id Christian. 2012/8/22 Anthony > Yes. Note, web2py stores GET variables in request.get_vars and POST > variables in request.post_vars. It stores both GET and P

Re: [web2py] Problem trying to get a value from a rows object

2012-08-22 Thread Anthony
Yes. Note, web2py stores GET variables in request.get_vars and POST variables in request.post_vars. It stores both GET and POST vars in request.vars. If both get_vars and post_vars have variables with the same name, it puts their values in a list within request.vars. Just change your code to us

Re: [web2py] Problem trying to get a value from a rows object

2012-08-22 Thread Massimo Di Pierro
You have two id fields. One in request.get_vars.id (from the url) and one in request.post_vars.id (from the form submission). On Wednesday, 22 August 2012 08:51:38 UTC-5, Christian Espinoza wrote: > > When I submit the form, on request.vars.id exist this value: ['2', '2'] > > this is the proble

Re: [web2py] Problem trying to get a value from a rows object

2012-08-22 Thread Christian Espinoza
Hello Antony, Before submit the form, id -> 2 , for example. After submit the form id -> ['2', '2'] maybe id is a reserved word for Web2py, when I did trace it on the debugger I saw that it change from a int number to a list, only in the process of submit a form, without a user interaction. C

Re: [web2py] Problem trying to get a value from a rows object

2012-08-22 Thread Anthony
It's really hard to say without seeing the code that generates the id. Somehow your id is a list instead of a single value. Anthony On Wednesday, August 22, 2012 9:51:38 AM UTC-4, Christian Espinoza wrote: > > When I submit the form, on request.vars.id exist this value: ['2', '2'] > > this is th

Re: [web2py] Problem trying to get a value from a rows object

2012-08-22 Thread Christian Espinoza
When I submit the form, on request.vars.id exist this value: ['2', '2'] this is the problem, but I dont know why, Im sending the var from the controller to it self with the 2 value only.. 'id' is a reserved function?? Christian. 2012/8/21 Anthony > How is request.vars.id being set -- in the

Re: [web2py] Problem trying to get a value from a rows object

2012-08-22 Thread Anthony
Perhaps you can pack and attach a minimal app that reproduces the problem (or at least show more code). It's still not clear where that id comes from or what's happening to it. Anthony On Wednesday, August 22, 2012 9:04:24 AM UTC-4, Christian Espinoza wrote: > > I'm sending the id var from a us

Re: [web2py] Problem trying to get a value from a rows object

2012-08-22 Thread Christian Espinoza
I'm sending the id var from a user list view on this way: edit_user.html: *Change Membership* edit_user.py: def edit_user(): if request.vars.id: etc return dict(form=form, id=request.vars.id) the id var come from another view when I was iterating over a query to get auth_user.id: but o

Re: [web2py] Problem trying to get a value from a rows object

2012-08-21 Thread Anthony
How is request.vars.id being set -- in the query string? What is its value when the form is created, and what is the value when submitted? On Tuesday, August 21, 2012 7:16:18 PM UTC-4, Christian Espinoza wrote: > > Hi Anthony, I was try with .select().first(), but I get a error in the > same wa

Re: [web2py] Problem trying to get a value from a rows object

2012-08-21 Thread Christian Espinoza
Hi Anthony, I was try with .select().first(), but I get a error in the same way... The Error appears after I submit the form with the changes over the field, the form for a id user works, the problem is when I submit it. Thanks. Christian 2012/8/21 Anthony > Also, note the .select().first() r

Re: [web2py] Problem trying to get a value from a rows object

2012-08-21 Thread Anthony
Also, note the .select().first() returns the first row or None if there are no results, so you don't have to test whether there are any records before selecting the first row. Anthony On Tuesday, August 21, 2012 6:58:47 PM UTC-4, rochacbruno wrote: > > You are getting an empty rows object > > >

Re: [web2py] Problem trying to get a value from a rows object

2012-08-21 Thread Christian Espinoza
Hi Bruno, this error appear after I submit the changes on the form, I can get the form without problems for a user, but the problem appears after submit any change. Christian El martes, 21 de agosto de 2012 18:58:47 UTC-4, rochacbruno escribió: > > You are getting an empty rows object > > > de

Re: [web2py] Problem trying to get a value from a rows object

2012-08-21 Thread Bruno Rocha
You are getting an empty rows object def change_membership(): if request.vars.id: row = db(db.auth_membership.user_id == request.vars.id).select() if not row: redirect(.) id = row[0].id form = SQLFORM(db.auth_membership,

[web2py] Problem trying to get a value from a rows object

2012-08-21 Thread Christian Espinoza
Hello, I'm trying to edit the group membership for a user, I have in my controller: def change_membership(): if request.vars.id: row = db(db.auth_membership.user_id == request.vars.id).select() id = row[0].id form = SQLFORM(db.auth_membership,