[Grok-dev] Execute function when server is shut down

Jan-Wijbrand Kolman janwijbrand at gmail.com
Thu Jan 13 03:35:21 EST 2011


On 1/13/11 1:09 AM, Leonardo Rochael Almeida wrote:
> Maybe what you want to do is register atexit methods:
>
> http://docs.python.org/library/atexit.html
>
> On Wed, Jan 12, 2011 at 18:30, Hector Blanco<white.lists at gmail.com>  wrote:
>> Yeah... I should've thought about that before sending the mail...
>> Since the __init__ is only called when I create a new instance of my
>> server, I should have realized that, in the best case the __del__
>> method would be called when an instance of the server is removed in
>> the server control page.
>>
>> Surprisingly (well... surprisingly for a newbie that doesn't have much
>> idea about how all that works) that doesn't happen... The __del__
>> method is not called when I remove an application.
>>
>> Well... maybe a workaround might be catching the signal send by the
>> operative system... (just saying... I don't know if that makes much
>> sense)

I'm not sure though of you have enough database context at this point in 
the life cycle of the app to do whatever you'd like to do.

In any case, please report what you find, others might benefit from this 
as well! (and I'd still like to find out exactly how a Zope app is 
shutdown).

regards, jw



More information about the Grok-dev mailing list