[Zope] Zope and threads.

Pascal Peregrina Pperegrina at Lastminute.com
Tue Feb 22 15:22:12 EST 2005

Ok, so, this almost completely answers my question.

Let me tell you more about what I am doing, because I agree that my initial
mail was not that clear. :)

I am trying to implement a ZeroConf browser (http://www.zeroconf.org/) in
Zope to automatically get the network location of XML RPC services that my
Zope objects talk to.

The ZMI part is easy. In my new product, I've got my object in the Control
Panel, and it is ready to display whatever data I want (for example the list
of discovered services).

The ZeroConf implementation itself has already been made by someone else

So I am just trying to plug pieces together now :)

>From my product, I need to start a thread that will run the ZeroConf code,
and ZeroConf data will then be accessible through a particular object of
this code (the "listener" to be exact, as they call it in pyzeronf).

This thread should be started when Zope starts, so I guess I can put it in
the __init__.py of my product.

I only got one issue : my product can be refreshed.
So how can I ensure that the ZeroConf stuff won't be re-initialized if I
refresh my product ? (ending with 2 threads, with one of the threads not
being used). I know this is more a python related question, but I haven't
found a precise answer on the net.

Thanks for your answers, and sorry that my first mail was unclear.


-----Original Message-----
From: Chris McDonough
To: Pascal Peregrina
Cc: 'zope at zope.org'
Sent: 22/02/2005 19:51
Subject: Re: [Zope] Zope and threads.

Hi Pascal,

It seems like the only thing you need to do is to launch a thread using
either the thread or threading module to do what you want if you're not
going to access any persistent objects from the newly created thread. 
Accessing nonpersistent objects created by another thread from within
Zope app code is not a problem.  

- C

On Mon, 2005-02-21 at 11:25, Pascal Peregrina wrote:
> Hi,
> I need to have some processing done in one thread, that will set some
> attributes of a (non persistent) object.
> This processing is completely independant from Zope objects.
> Zope objects (persistent or non-persistent) will only need to "read"
> data from this object.
> What would be the best way to do this (specially how to initialize my
> thread ?)
> Thanks
> Pascal
> **********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
> This footnote also confirms that this email message has been swept by
> MIMEsweeper for the presence of computer viruses.
> www.mimesweeper.com
> **********************************************************************
> ______________________________________________________________________
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )

More information about the Zope mailing list