[Grok-dev] Execute function when server is shut down
Leonardo Rochael Almeida
leorochael at gmail.com
Wed Jan 12 19:09:57 EST 2011
Maybe what you want to do is register atexit methods:
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
> 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
>>> 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
>> 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
> Grok-dev mailing list
> Grok-dev at zope.org
More information about the Grok-dev