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 | [EMAIL PROTECTED] | 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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss
-~----------~----~----~----~------~----~------~--~---

Reply via email to