It is. after_delete is executed after delete therefore the record is no 
longer there to be selected.

On Monday, 14 January 2013 09:20:16 UTC-6, Kostas M wrote:
>
> According to the book, in the DAL chapter, subtitle: 'before and after 
> callbacks', we can use:
>
> >>> db.person._before_delete.append(lambda s: pprint(s))
> >>> db.person._after_delete.append(lambda s: pprint(s))
> where: 
> s is the Set object used for update or delete.
>
> However,
> def person_before_delete(s): #s a Set object
>     anid=s.select()[0].name
>     
> def person_after_delete(s): #s a Set object     
>     anid=s.select()[0].name
>
> The first function, actually can get this name value, whereas the second 
> cannot. In the second case, the
> len(s.select()) returns 0 rows. Is this the expected behaviour?
> I need the 'name' value of the deleted row, for some further actions, and now 
> I am using both "_before_delete"
> to get the value I want and set some global variable in my db.py, and then 
> "_after_delete" to trigger an update
> function of the actual count of the persons left, using the stored global 
> variable. But this way, doesn't look
> so right to me.
>
>
>

-- 



Reply via email to