[Zope] Newbie External Method - Python help

Dieter Maurer dieter@handshake.de
Tue, 8 Jan 2002 23:27:56 +0100


=?iso-8859-1?Q?Vicente_Castell=F3_Ferrer?= writes:
 > ... global variables in External Method ...
You can try Python's "global" directive:

  def fun(...):
    global x
    ...
    x= ...

  The "global" directive tells Python that the variables belong to the
  module's namespace (and not the functions one).

Be careful, however:

  In earlier Zope versions, at least until Zope 2.2, probably longer,
  the source files of External Methods have not been Python modules.
  Its variables have been thread local. This means, that different
  requests could see different values.

  I think, in Zope 2.4 and above, the files are standard Python modules
  but I am not sure.



Dieter