[Zope] Time-consuming External method blocks Zope execution

Oleg Broytmann Oleg Broytmann <phd@phd.fep.ru>
Sun, 17 Jun 2001 14:50:47 +0400 (MSD)


On Sat, 16 Jun 2001, Oleg Broytmann wrote:
> > >http://home.netscape.com/assist/net_sites/pushpull.html
>
> On Fri, 15 Jun 2001, shawn grant wrote:
> > I have been unable to get this method to work.  I went to the Netscape
> > page and tried their example.  It didn't work with Netscape 4.75 on
> > windows or linux (as well as IE and mozilla).  Is this still a supported
> > mimetype?  Has anyone gotten this to work in or outside of zope?
>
>    I have not tested Server Push for quite some time. May be 5 years. There
> is a chance they stopped supporting Server Push. I'll try to test it later
> next week.

   The following code works for me in Netscape 4.77 and Mozilla 0.9.
Text-mode browsers (links/lynx/w3m) don't work. I'd like to hear reports
about M$IE.

#! /usr/local/bin/python -O


import sys, time
import mimetools


class ServerPush:
   def __init__(self, out=sys.stdout):
      self.out = out
      self.output = out.write
      self.boundary = mimetools.choose_boundary()


   def start(self):
      self.output("""\
Content-type: multipart/x-mixed-replace;boundary=%s

""" % self.boundary)


   def next(self, content_type="text/html"):
      self.output("""\
--%s
Content-type: %s
""" % (self.boundary, content_type))


   def stop(self):
      self.output("--%s--" % self.boundary)


server_push = ServerPush()
counter = 0

server_push.start()

while counter < 5:
   server_push.next("text/plain")
   print

   counter += 1
   print counter

   sys.stdout.flush()
   time.sleep(2)

server_push.stop()

Oleg.
----
     Oleg Broytmann     http://www.zope.org/Members/phd/     phd@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.