Groups
Groups
Sign in
Groups
Groups
Django users
Conversations
About
Send feedback
Help
HttpResponse methods difference
36 views
Skip to first unread message
Yarick Antonov
unread,
Aug 27, 2014, 8:48:16 PM
8/27/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
What the difference between
HttpResponse.Write()
,
HttpResponse.
flush
()
and
HttpResponse.tell()
methods?
ma...@tubeards.com
unread,
Aug 28, 2014, 10:31:12 AM
8/28/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
As you see in:
https://github.com/django/django/blob/master/django/http/response.py#L370
all three methods have different usecases.
.write(string) <- adds content
.tell() <- returns the length of content
.flush() <- just passing, does nothing (since at lease v1.5)
Cheers
Collin Anderson
unread,
Aug 28, 2014, 10:33:55 AM
8/28/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
It's the same as python file objects
write sends data to the response
flush makes sure the data you wrote is actually getting sent out, not just buffered for alter
tell tells you how much data you've read or written. is where are you in the "file"
https://docs.python.org/3/library/io.html
Reply all
Reply to author
Forward
0 new messages