[Zope] Globals disappearing in extmethod?

Thomas B. Passin tpassin@mitretek.org
Mon, 4 Feb 2002 17:26:17 -0500


[Joseph A Knapka]
>
> > How are you making use of your myGlobals module? Just importing * from
it?
>
> import myGlobals
> def myExtMethod(REQUEST):
>    myGlobals.req_data = REQUEST
>    ...
>
> ... then use "myGlobals.req_data" instead of just "req_data"
> everywhere else in the file.

I do the same kind of thing to let a module find the root of its directory
subtree.  The modules are in a package, and in the __init__.py I get the
root location from __file__.  I import it where I want to use it with
external methods and it lets me put things into the right locations.  That
way I  don't have to hard-code the root location.

Cheers,

Tom P