In article <37BEAC6C.3DDDA7EC@digicool.com>, Michel Pelletier <michel@digicool.com> writes
Robin Becker wrote:
...
When Zope starts up it imports all the modules containing external methods. It might be possible to place code directly in the module for execution upon import.
I'm not 100% certain, however, but I don't see why this standard python feature would have been disabled.
-Michel ... I tried that before and found I was getting a different version of my module globals somehow when the function was called. I already had a job queue set up, but it was being fooled somehow.
My example is as follows; the following is in root/Extensions (parallel to root/var) #### external method doesn't have proper globals import time JQ=0 class Thing: def __init__(self): global JQ self.I=JQ JQ=JQ+1 def val(self): global JQ import time time.sleep(10) return "%s I=%d JQ=%d"%(str(self),self.I,JQ) thing=Thing() def drongo(self): return thing.val() I add this as function test/drongo with function drongo when I run this twice (nearly simultaneously) I get <?.Thing instance at 1ee9aa0> I=0 JQ=1 from one and <?.Thing instance at 1eb6e30> I=0 JQ=1 from the other a third run gives <?.Thing instance at 1eb6e30> I=0 JQ=1 so I had two versions of the global at one point.
Do I have to make a product or is there some easier way to do this. -- Robin Becker
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://www.zope.org/mailman/listinfo/zope-dev
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For non-developer, user-level issues, zope@zope.org, http://www.zope.org/mailman/listinfo/zope )
-- Robin Becker