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()
There is another thing:
Related to this, I am working with the experimental haystack
plugin for whoosh, but I have made some changes (for using the
whoosh backend with python3 and other things), but I look that the
Github project page has no updates and there are unattended pull
requests. Is the haystack plugin dead?
Greetings.
--
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+un...@googlegroups.com.
For more options, visit MailScanner ha detectado un intento de fraude en la siguiente página web "groups.google.com". No confíe en esta página web: MailScanner ha detectado un intento de fraude en la siguiente p�gina web "groups.google.com". No conf�e en esta p�gina web: https://groups.google.com/d/optout.
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()
rows = s.select()
tables = db._adapter.tables(s.query)
Thank you so much!!!
Greetings.
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