[Zope] Persisting data in a module for hit counter

Dieter Maurer dieter at handshake.de
Wed Feb 25 16:28:11 EST 2004

Max M wrote at 2004-2-25 15:43 +0100:
> ...
>The problem is when zope is stopped, or a module is reloaded, then it 
>looses all data.
>Is there any way to know when a module goes out of scope, so that I can 
>get a hook to save/pickle the dictionary? Or at least a way to know when 
>zope is shut down?

There is not reliable way, as Zope may die unexpectedly (e.g.
caused by a signal).

"refresh" lets you control that some modules are not reloaded
during a refresh.

There is no hook to intercept module deletion.

There is a hook to get control at program exit.
It is called "atexit" (or similar).
As modules usually do not disappear by themselves, this
may be enough. As said, it is not reliable in case of abnormal


More information about the Zope mailing list