[EMAIL PROTECTED] wrote:
> For example, if I wanted to build a malling application, I have to 
> display the email address each time an email is sent, say every 2 sec. 
> Processing can be quite long, so I cannot accumulate the output and 
> return the HttpResponse at the end, because the connection would 
> timeout. I need to keep the HTTP connection open, and regularly flush 
> the data.

HttpResponse can accept an iterator instead of a string. For your case 
it can look like this:

     def send_mails():
       for address in addresses:
         send_mail(address)
         yield '%s<br>' % address

     ...

     def send_mails_view(request):
       return HttpResponse(send_mails())

This will sent an address each time it is processed right through all 
the web stack to the client.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to