27 Jun
2005
27 Jun
'05
6:05 p.m.
Max M wrote at 2005-6-27 15:53 +0200:
... So in a external method/module I have a function like this:
BUSY_STATE = 0 def sync_in_progress(busy=None): global BUSY_STATE if busy is None: return BUSY_STATE else: BUSY_STATE = busy
Note that this is likely to fail. The module containing an External Method is maintained in the ZODB cache. As a consequence, each worker gets its own copy and you cannot synchronize via global variables of such modules. Use a true Python module (note that Zope does not import the source file of an External Method; therefore, it is not inside a module in the Python sense) when you need synchronization via global module level variables. -- Dieter