On Sun, 2007-12-16 at 16:14 -0800, azer wrote:
> Hi,
>
> I'm trying to use Time.sleep function on printing, here is the code:
>
> def sleep(request):
> res = HttpResponse()
> res.write("hello")
> time.sleep(3)
> res.write("hello");
> return res
>
> But it doesn't work (Page waits 3 seconds and prints "hellohello"),
> how can i solve this problem? If we can solve this problem, i think
> that we can create comet applications easily...
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.
If you want to implement something streamable for Comet purposes, you'll
need to implement your own, slightly lower-level interaction with the
webserver and the downstream client. Django doesn't have built-in
support for that.
Regards,
Malcolm
--
Why be difficult when, with a little bit of effort, you could be
impossible.
http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---