[Zope] global variables in externa Methods

Dieter Maurer dieter@handshake.de
Fri, 13 Dec 2002 22:43:40 +0100


Elena Schulz writes:
 > I want to set globale variables in external methods.
Don't!

The "module" namespace of external methods exists in copies
for the different threads.

If you set (global) variables in one thread, other threads
will not see them.

When you need (module) global variables, put them into a real
Python module (or packages) not in the source of an External Method.
The namespaces of such modules are shared by all threads.

Depending on the use of the global variables, you must
synchronize access to them by means of locks.


Dieter