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:10 PM UTC-4, Jean-Baptiste Fuzier wrote: > > Hi, > > I am having trouble finding the right way to do this : > > > - I have a table, each row has an owner which is the only one allowed > to edit or delete it > - Ownership is represented thanks to auth_permission (permission > 'owner') > - I would like to use ondelete and onupdate callbacks to verify that > the auth.user indeed owned the row, the test is working fine within the > callback function. However I do not know how to properly stop the update > or > delete when the user does not own the row > - I managed to make this work in a pretty ugly way I think by > raising an Exception within the ondelete callback when the user is not > allowed to remove the row > - However I can't to it with update as the exception seems not to > be catched ... > > Am I missing something ? > > Thanks for your help ! > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.