Actually, it turns out you need to use the _before_delete callback -- it 
should be executed, even when using record versioning.

Anthony

On Wednesday, April 8, 2015 at 5:14:00 PM UTC-4, 黄祥 wrote:
>
> the delete call back execute on after update callback can't passed the set 
> object to get an id deleted.
> e.g.
> def after_update_event(s, f, table):
> table_input = s.select().first()
> if 'is_active' in f and f['is_active'] == False:
> 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' % (s, 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 updated in table %s' % (table_input.id, table) )
>
> *result*
> 1. strange result, that the s (set object) have the same value (delete n 
> update) when trying to print it, but the problem is during the delete aka 
> update the is_active = False, the id seems is not passed. when passed it 
> table_input.id, it return an error
> Error snapshot [image: help] 
> <https://127.0.0.1/admin/default/ticket/visitor/127.0.0.1.2015-04-09.04-04-01.fd258349-3438-4459-aa0e-ba1c1c8b7a25#>
>
> <type 'exceptions.AttributeError'>('NoneType' object has no attribute 'id')
> 2. during the delete (is_active = False), the f (dict of fields) didn't 
> have the id value too (already test print the f key), it just passed some 
> of auth.signature, is_active, modified_on, modified_by, etc
>
> how can i get the id deleted in update callback that have auth.signature 
> active?
>
> thanks and 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.

Reply via email to