Malcolm Tredinnick wrote
> Based on your later, slightly cryptic reply in this thread, I gather you
> are hoping that HttpResponse is acting as a streamable pipe back to the
> browser. This isn't correct. You create an HttpResponse instance and
> when you return from your view, Django will send all of the content back
> to the user in one go. Nothing happens until you return from the view.
>
There is one way: using a generator you can simulate "streaming". The
code below actually sends two chunks of response data in the TCP/IP
stream at 1 second interval.
def example_generator():
yield 'foo'
time.sleep(1)
yield 'bar'
def my_view():
return HttpResponse(dummy_generator())
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---