[web2py] Re: Doing validation using sqlform grid onupdate or ondelete callbacks

2013-03-22 Thread Jean-Baptiste Fuzier
Thanks, awesome answer ! I think I'm gonna go with the table callback method, I kind of feel safer when doing security checks closer to the DB (maybe I'm wrong...) - For the second solution (Authorization), as I am using a sqlform.grid, I need to provide a query and not rows. So I tried

[web2py] Re: Doing validation using sqlform grid onupdate or ondelete callbacks

2013-03-22 Thread Jean-Baptiste Fuzier
Thanks, This solution is working fine for the edit part. You gave me a better understanding of the form validation mechanism, thanks. However I think I'm gonna go with luismurciano's approach which seems closer to what I am looking for... Thanks again for your help! Le jeudi 21 mars 2013 21:0

[web2py] Re: Doing validation using sqlform grid onupdate or ondelete callbacks

2013-03-21 Thread luismurciano
Hi There are some easy ways to do it. If the owner reference is in the row you can use before and after callbacks something like: db.mytable._before_update.append(lambda s,r: True if r.owner == auth.user_id else Fa

[web2py] Re: Doing validation using sqlform grid onupdate or ondelete callbacks

2013-03-21 Thread Cliff Kachinske
I would do onvalidate. Then you can redirect before damage is done or you can do something like: form.errors['the_restricted_field'] = "Gotcha!! What were you thinking? You cannot edit this record. Go away." You may wish to use a less abusive error message. On Thursday, March 21, 2013 2:26