Sean McGrath writes:
 > I want to synchronize ...
 > I tried using the threading module and creating
 > a Lock object as a global in the external method.
 > This does not help as each request gets allocated its
 > own Lock object....

As you observed, each thread gets its own global namespace
for a file containing an external method.

The namespace of a true Python module, however, is shared
by all threads. Therefore, it is a good place for your

Do the following (or something along similar lines):

 * create a properly named subpackage in "lib/python/Shared"
   (to avoid name clashes), say "myCompany".

 * create a Python module in "myCompany", say "".

 * create your lock in this module, say "Lock"

 * access it in your external method by:

        from Shared.myCompany.myLock import Lock


Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to