12 messages in com.googlegroups.pylons-discussRe: Sending intermediate content| From | Sent On | Attachments |
|---|---|---|
| jose | 15 Aug 2006 23:06 | |
| Ben Bangert | 16 Aug 2006 10:18 | |
| Ben Bangert | 16 Aug 2006 10:33 | |
| Ben Bangert | 16 Aug 2006 10:54 | |
| jose | 16 Aug 2006 18:34 | |
| jose | 17 Aug 2006 08:44 | |
| Ian Bicking | 17 Aug 2006 08:50 | |
| jose | 17 Aug 2006 08:58 | |
| benchline | 17 Aug 2006 09:02 | |
| askel | 17 Aug 2006 09:37 | |
| Ben Bangert | 17 Aug 2006 09:48 | |
| benchline | 17 Aug 2006 10:06 |
| Subject: | Re: Sending intermediate content![]() |
|---|---|
| From: | Ian Bicking (ia...@colorstudy.com) |
| Date: | 08/17/2006 08:50:56 AM |
| List: | com.googlegroups.pylons-discuss |
jose wrote:
I just gave this a try and it didn't give me the result I was expecting. The code I tried is:
def index(self): req = request.current_obj() def long_func(): env = req.environ yield 'I am starting now' #simulate a very long process for i in range(10000): print i yield 'I should be finishing now' res = Response() res.content = long_func() return res
I know that this really does not do anything, I am just trying to get the use-case to work. What I expected to see in the browser was first the "I am starting now" statement, followed by by the print stuff in the cmd window followed by the last statement being sent to the browser. Instead it looks like either its all being sent at once, or the browser is waiting for the page to finish before anything gets rendered. Do you know of any way to test to see which is it?
If you really want to send out content over time, you need to use the writer that start_response returns; the iterator allows for incremental production of a response, but it's up to the server exactly when/how to send it out and it might be buffered.
I don't know if Pylons normally gives access to the writer start_response returns?
-- Ian Bicking | ia...@colorstudy.com | http://blog.ianbicking.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to pylo...@googlegroups.com
To unsubscribe from this group, send email to
pylo...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/pylons-discuss
-~----------~----~----~----~------~----~------~--~---




