On Tuesday, December 19, 2017 at 8:48:15 AM UTC-5, Carlos Cesar Caballero wrote: > > Hi Massimo, thanks for your answer, basically I need the row object > instead of the set in the after update callback, I have managed to do this > passing the table object to my plugin and making a query. But there is a > way to know the table that belongs an after update callback without passing > explicitly the table object? > > Let's say something like: > > model: > > from mymodule import my_after_update_callback > > db.mytable._after_update.append(my_after_update_callback) > > mymodule: > > def my_after_update_callback(s, f): row = get_callback_row() > > table = get_callback_table() > > > Updates do not involve fetching the updated records from the database, so the DAL does not have any Row objects to provide to the callback. If you need the updated records, you'll have to fetch them yourself within the callback based on the Set:
rows = set.select() Regarding the tablename, you can extract it from the Set as well. In most cases, something like the following should work: table = set.query.first.table Note, that will be the actual DAL Table object -- if you want the name, you can do set.query.first.tablename. Anthony -- 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.