Code

Opened 7 years ago

Closed 7 years ago

#5165 closed (invalid)

HttpResponse's flush method does not do anything

Reported by: arthur.vuillard@… Owned by: mtredinnick
Component: HTTP handling Version: master
Severity: Keywords: httpresponse flush
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

HttpResponse flush method should flush the content previously written by the write method to the socket but this method doesn't do anything :

def flush(self):

pass

This method should be really useful in some Ajax web application.

Attachments (0)

Change History (2)

comment:1 Changed 7 years ago by Simon G. <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 7 years ago by mtredinnick

  • Resolution set to invalid
  • Status changed from new to closed

HttpResponse classes are agnostic about the downstream communication method. So there's no concept of a socket or network connection for it to flush. I think you're trying to solve some problem with the wrong abstraction here. Comet-style data streaming and trying to have fine-grained control over output chunking would need attention in the HTTP handlers area, not in this class.

The only reason HttpResponse has a flush() method at all is because we need it to behave as a file-like object and some applications require flush() to exist (although it need not do anything, as noted by the Python docs).

You might wish to raise whatever problem you are trying to solve on django-users to get some ideas about how to handle it.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.