Don't check the Row object -- instead, directly inspect the update fields: if 'is_active' in f and f.is_active == False: [log delete event] else: [log update event]
If you have some tables that aren't tracking revisions, then you will need a standard _after_delete callback for those. Anthony On Wednesday, April 8, 2015 at 9:26:58 AM UTC-4, 黄祥 wrote: > > just follow your hints, it works well n avoid me having an ugliness code > (for put insert n update callback for every defined tables), but as > describe later the before callback is still not work after following your > hints. actually i kinda love the idea to set the is_active into False > rather than delete the record but till now, doesn't know how to handle it > (before delete callback when the default auth.signature is used). > e.g. > *models/db_wizard_event_log.py* > for table in db.tables: > if table != 'auth_event': > db[table]._after_insert.append(partial(event_log.after_insert_event, table > = table) ) > db[table]._after_update.append(partial(event_log.after_update_event, table > = table) ) > > *modules/event_log.py* > def after_update_event(s, f, table): > table_input = s.select().first() > if table_input.is_active == True: > current.db.auth_event.insert(time_stamp = current.request.now, client_ip = > current.request.client, > user_id = current.auth.user_id, origin = '%s/%s' % > (current.request.controller, current.request.function), > description = 'ID %s updated in table %s' % (table_input.id, table) ) > else: > current.db.auth_event.insert(time_stamp = current.request.now, client_ip = > current.request.client, > user_id = current.auth.user_id, origin = '%s/%s' % > (current.request.controller, current.request.function), > description = 'ID %s deleted in table %s' % (table_input.id, table) ) > > *error* > when click delete icon on sqlform.grid just said (same result when using > before delete callback on sqlform.grid with auth signature) > An error occured, please reload <https://127.0.0.1/visitor/master/bank> the > page × > > when tickmark the delete on the edit page of sqlform.grid it return an > error : > Error snapshot [image: help] > <https://127.0.0.1/admin/default/ticket/visitor/127.0.0.1.2015-04-08.20-21-42.078930c6-1ed2-48fc-9d44-a4c8b0002e0c#> > > <type 'exceptions.AttributeError'>('NoneType' object has no attribute > 'is_active') > > best regards, > stifan >> >> -- 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.