[Zope] Using zope as something more than just dynamic webpages

Paul Winkler pw_lists@slinkp.com
Tue, 2 Jul 2002 06:03:49 -0400


> >alwyn@smart.com.ph writes:
> > > Is it then possible for example to have pieces of Python code start up 
> >when
> > > zope start up that will be persistent and executing for as long as zope
> > > runs?

If by "executing" you mean "running a loop indefinitely",
maybe you could do something like (untested)

- make a Product by copying the "Boring" product

- in Boring.py (or whatever you call it),
   add this to the end of __init__():

    import time
    delay_seconds = 1
    while 1:
        # your code goes here
	time.sleep(delay_seconds)

- Add an instance of this product somewhere in your zope tree.

Your code should then start running sometime before Zope
finishes starting up, and will run as long as Zope is up.
It can be disabled by removing the instance of the Product.


--

Paul Winkler
home:  http://www.slinkp.com
"Muppet Labs, where the future is made - today!"