Re: [Zope] Time-consuming External method blocks Zope execution
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? On Fri, 15 Jun 2001, Oleg wrote:
On Thu, 14 Jun 2001, Dieter Maurer wrote:
Jerome Alet writes:
you have to return a document which content-type is:
multipart/x-mixed-replace;boundary=XXX Very Interesting!
* where did you find this (extension) MIME type documented?
This is called Server Push (to distinguish from Client Pull): http://home.netscape.com/assist/net_sites/pushpull.html
* what browsers support this?
All major browsers from ancient times.
Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru <mailto:phd@phd.pp.ru> Programmers don't die, they just GOSUB without RETURN.
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. Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Sat, 16 Jun 2001, Oleg Broytmann wrote:
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.
Make sure you are not confusing the problem of just flusing a buffer's worth of html vs replacing some mutipart mime document with another. For example note the use of flush to pump stuff to the browser in this TCL cgi example: #!/local/bin/tclsh puts "Content-type: text/html\n"; puts "<HTML>"; puts "<HEAD>"; puts "<TITLE>Pipleine Monitoring for Seismic Modeling</TITLE>"; puts "</HEAD>"; puts "<H1>Pipleine Monitoring for Seismic Modeling</H1>"; puts "<HR>"; puts "<P>"; for {set i 0} {$i <= 100} {incr i} { puts "Hi there<br>"; puts "<SCRIPT LANGUAGE=\"JavaScript\">"; puts "<!-- Hide from stupid browsers -->"; puts "self.scroll(1,10000000)"; puts "//-->"; puts "</SCRIPT>"; flush stdout; after 1000; } This will cause the browser to scoll to the end or an ongoing list being dumped to the browser. (Sorry, but this was a ready example. I know tcl is ugly ;-) ). FYI, Albert Boulanger aboulanger@vpatch.com
On Fri, Jun 15, 2001 at 01:17:32PM -0700, 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?
Works fine here on my Debian potato with Netscape 4.75. I can send you a very long python CGI script if you want to see the code, but it's not easily readable because it's an SQL CGI frontend to PostgreSQL, slightly specialised for a particular application. bye, Jerome Alet
What you do wrong is your second and third setHeader which overwrite the first one. in fact after the first setHeader you can't call it again, you have to 'manually' write the response, e.g.: <UNTESTED> ... <dtml-call "RESPONSE.write('Content-Type: text/plain\n\n')"> <dtml-call "RESPONSE.write('Dont forget the two linefeeds after the headers')"> ... </UNTESTED> bye, Jerome Alet
shawn grant writes:
Here's an example of my test method. Maybe you can tell me what I'm doing wrong:<br> <br> <dtml-call "RESPONSE.setHeader('content-type','multipart/x-mixed-replace;boundary=ThisRandomString')"><br> <br> <dtml-call "RESPONSE.write('--ThisRandomString')"><br> <dtml-call "RESPONSE.setHeader('content-type','text/plain')"><br> This will not work!
The first "write" sends the message headers, all subsequent "setHeader" are ineffective. Dieter
participants (5)
-
albert boulanger -
Dieter Maurer -
Jerome Alet -
Oleg Broytmann -
shawn grant