Is it possible to "stream" (send data to the client via HTTP incrementally) from Python code, or does ZPublisher only send the data as a single wad when the method returns? Assuming it is possible, obviously it requires using some other API rather than just 'return'ing a string... where can I find documentation and/or examples on that? If there is no existing documentation or examples, source code would do. (Context: when the tests are running on ZUnit, I'd like to give some visual feedback, if possible by sending the dots returning by PyUnit in real-time) []s, |alo +---- -- Hack and Roll ( http://www.hackandroll.org ) News for, uh, whatever it is that we are. http://zope.gf.com.br/lalo mailto:lalo@hackandroll.org pgp key: http://zope.gf.com.br/lalo/pessoal/pgp Brazil of Darkness (RPG) --- http://zope.gf.com.br/BroDar
Isn't that dependant on the protocol u are using to transfer the data? HTTP can't do streaming. You can sort of do streaming using the experimental multipart content type, but IE browers don't recognise it, so it is pretty useless. With the context you gave, you could probably do that with the experimental multiplart content, but it would only work with netscape. terry Lalo Martins wrote:
Is it possible to "stream" (send data to the client via HTTP incrementally) from Python code, or does ZPublisher only send the data as a single wad when the method returns?
Assuming it is possible, obviously it requires using some other API rather than just 'return'ing a string... where can I find documentation and/or examples on that? If there is no existing documentation or examples, source code would do.
(Context: when the tests are running on ZUnit, I'd like to give some visual feedback, if possible by sending the dots returning by PyUnit in real-time)
[]s, |alo +---- -- Hack and Roll ( http://www.hackandroll.org ) News for, uh, whatever it is that we are.
http://zope.gf.com.br/lalo mailto:lalo@hackandroll.org pgp key: http://zope.gf.com.br/lalo/pessoal/pgp
Brazil of Darkness (RPG) --- http://zope.gf.com.br/BroDar
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
On Mon, Oct 30, 2000 at 12:23:36PM +1100, Terry Kerr wrote:
Isn't that dependant on the protocol u are using to transfer the data? HTTP can't do streaming. You can sort of do streaming using the experimental multipart content type, but IE browers don't recognise it, so it is pretty useless.
What are you talking about? Try to load any standard html page with a very slow connection. If you just send the data slowly, the browser will show it as it is received. That's streaming. You can point an mp3 or realaudio player at an URL and it will download the file and play it as it arrives. That's the kind of streaming I want to do. []s, |alo +---- -- Hack and Roll ( http://www.hackandroll.org ) News for, uh, whatever it is that we are. http://zope.gf.com.br/lalo mailto:lalo@hackandroll.org pgp key: http://zope.gf.com.br/lalo/pessoal/pgp Brazil of Darkness (RPG) --- http://zope.gf.com.br/BroDar
That is not streaming. That is just as you said..lack of bandwidth delaying the entire page arriving at once at you browser. That is not contolled. The server doesn't send it 'bit by bit' in a controlled manner. terry Lalo Martins wrote:
On Mon, Oct 30, 2000 at 12:23:36PM +1100, Terry Kerr wrote:
Isn't that dependant on the protocol u are using to transfer the data? HTTP can't do streaming. You can sort of do streaming using the experimental multipart content type, but IE browers don't recognise it, so it is pretty useless.
What are you talking about? Try to load any standard html page with a very slow connection. If you just send the data slowly, the browser will show it as it is received. That's streaming.
You can point an mp3 or realaudio player at an URL and it will download the file and play it as it arrives.
That's the kind of streaming I want to do.
[]s, |alo +---- -- Hack and Roll ( http://www.hackandroll.org ) News for, uh, whatever it is that we are.
http://zope.gf.com.br/lalo mailto:lalo@hackandroll.org pgp key: http://zope.gf.com.br/lalo/pessoal/pgp
Brazil of Darkness (RPG) --- http://zope.gf.com.br/BroDar
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
On Mon, Oct 30, 2000 at 12:48:53PM +1100, Terry Kerr wrote:
That is not streaming. That is just as you said..lack of bandwidth delaying the entire page arriving at once at you browser. That is not contolled. The server doesn't send it 'bit by bit' in a controlled manner.
But if it did, the results would be exactly the same. Actually, that's exactly what most people refer to when they say "streaming". This is getting way off-topic. I want to know if there is an API for that, not to discuss the meaning of the word. []s, |alo +---- -- Hack and Roll ( http://www.hackandroll.org ) News for, uh, whatever it is that we are. http://zope.gf.com.br/lalo mailto:lalo@hackandroll.org pgp key: http://zope.gf.com.br/lalo/pessoal/pgp Brazil of Darkness (RPG) --- http://zope.gf.com.br/BroDar
Never mind, I found it. Just for the record, if anyone else needs this: The class HTTPResponse (in ZPublisher/HTTPResponse.py) has a "write" method. When you're publishing to the web, the RESPONSE object is an instance of this class. def write(self,data): """\ Return data as a stream HTML data may be returned using a stream-oriented interface. This allows the browser to display partial results while computation of a response to proceed. The published object should first set any output headers or cookies on the response object. Note that published objects must not generate any errors after beginning stream-oriented output. """ I don't know if this is documented somewhere, but it does what I wanted. On Sun, Oct 29, 2000 at 11:05:25PM -0200, Lalo Martins wrote:
Is it possible to "stream" (send data to the client via HTTP incrementally) from Python code, or does ZPublisher only send the data as a single wad when the method returns?
Assuming it is possible, obviously it requires using some other API rather than just 'return'ing a string... where can I find documentation and/or examples on that? If there is no existing documentation or examples, source code would do.
(Context: when the tests are running on ZUnit, I'd like to give some visual feedback, if possible by sending the dots returning by PyUnit in real-time)
[]s, |alo +---- -- Hack and Roll ( http://www.hackandroll.org ) News for, uh, whatever it is that we are. http://zope.gf.com.br/lalo mailto:lalo@hackandroll.org pgp key: http://zope.gf.com.br/lalo/pessoal/pgp Brazil of Darkness (RPG) --- http://zope.gf.com.br/BroDar
Lalo Martins wrote:
Never mind, I found it. Just for the record, if anyone else needs this:
<snip>
I don't know if this is documented somewhere, but it does what I wanted.
It is documented in the online help system, under API documentation, under the 'Response' object. -Michel
participants (3)
-
Lalo Martins -
Michel Pelletier -
Terry Kerr