Thanks, but I can't do that, because the controller is used for the grid and several other functions (onvalidation, ondelete, etc.). Besides, "locking" a record for the entire time a user is looking at it isn't a good practice.
Until I found/learn a better solution with web2py, I'm using an old school lock file. I create the file when I start the procedure I mentioned on one of the first messages and delete it in the last step. This is not a perfect solution but is better that none. If you checked my answer to Anthony I suspected that the 2nd error message would be something like what you describe. What I'm confused about is the 1st error message. I can't understand it. quinta-feira, 21 de Março de 2019 às 23:32:28 UTC, Leonel Câmara escreveu: > > That's weird. It seems looking at the adapter in pydal, sqlite does not > start a transaction after connection like most adapters. Reading the sqlite > documentation, that's probably because sqlite starts a transaction > automatically as soon as anything writes to the database. > > So, basically, you can use for_update in a select to start a transaction > but only if sqlite didn't have any reason to start one before you did, > which you want to do because by default sqlite starts transactions in > *deferred > *mode which means it only locks when it thinks it needs to. So what you > want to do is to have a for_update select as the very first line in your > controller and then use no other for_update=True as that will try to start > a transaction in *immediate* mode again. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

