Opened 9 years ago

Closed 9 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:


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):


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

Change History (2)

comment:1 Changed 9 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 9 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.

Note: See TracTickets for help on using tickets.
Back to Top