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

Hector Blanco white.lists at gmail.com
Wed Jan 12 12:30:39 EST 2011


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)

2011/1/10 Jan-Wijbrand Kolman <janwijbrand at gmail.com>:
> On 12/23/10 17:59 PM, Hector Blanco wrote:
>> Hello everyone...
>>
>> I'd like to know if there's a way to execute some commands (closing
>> database connection, finish transaction...) when the grok server is
>> shutdown.
>>
>> I tried to add a __del__ method to my "Server(grok.Application,
>> grok.Container)" but it doesn't seem to work.
>
> I think if the __del__() were to be called in a way that is useful to
> your case, it would've been called when the instance is cleared from the
> database.
>
> I searched for an event that might be fired upon shutdown, but there
> seems not to be one. It actually make me wonder how shutdown actually
> works. This needs a bit of investigation...
>
> regards, jw
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev
>


More information about the Grok-dev mailing list