_after_update of course runs *after* the records have been updated in the database, so if you use the Set to check those records in the _after_update callback, they will therefore now have the new values. How could it be any other way? Accessing the Set in the _after_update callback can still be useful, even though it does not enable you to access the old values.
Note, when records are updated, they are not first retrieved from the database, so the DAL does not even know the original values of the updated records. Is it possible you could do what you need via the _before_update callbacks? If not, perhaps in the _before_update callback you could retrieve the records based on the Set and store them in an object in the global environment, and then have _after_update read the records you have stored. Anthony On Tuesday, April 1, 2014 9:39:57 AM UTC-4, mcamel wrote: > Hello, > > I'm trying to get a solid way of triggering an action, "after" an update, > based on the data "before" the update. > > One approach is building an SQLFORM, inject the old values as hidden > fields, validate it and do the update and triggers manually, but then you > are limited to use this FORM (it wouldn't work the same if you edit the > record on a grid, e.g.). > > Theoretically, the safer and "universal" way is with 'after_update' > callback, as in: > > > http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#before-and-after-callbacks > > I imagined the Set accesing these old values, but that's true only for > 'before_update' callback. These was a surprise because i cannot find any > difference from the record of field values, except the id, but this could > be passed explicitly as it is done in 'after_insert' callback. > > So, what's the purpose of the Set in 'after_update', then?. And, is there > another way to obtain the old values?. > > Regards. > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.