[Zope] Globals disappearing in extmethod?
Thomas B. Passin
tpassin@mitretek.org
Mon, 4 Feb 2002 16:28:20 -0500
[Joseph A Knapka]
>
> OK, I lied, Zope wasn't using the re-globalfied version, which
> still breaks. However, I've managed to narrow the problem down:
> The problem with global data being "missing" only
> happens when the DTML doc that calls my external method is
> invoked from a particular other DTML document.
>
> Also, I discovered that if I create an empty module
> called "myGlobals", and explicitly place all my
> global data there, everything works. Still confused,
> trying to build a simple case that breaks the same
> way as my original code.
>
Well, in Python you can invoke any function with your own context (globals
and locals). Zope may supply its own globals when it calls an external
method , and maybe in some cases that would prevent yours from being known.
It's an area I don't know much about. I'd still prefer to pass everything
as explicit parameters, but I can see cases where it would be useful to use
various global variables.
How are you making use of your myGlobals module? Just importing * from it?
Cheers,
Tom P