Project

General

Profile

Task #4077

Story #3944: DataONE Python products

Look into using Django's StreamingHttpResponse in GMN

Added by Roger Dahl about 11 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
-
Start date:
2013-10-11
Due date:
% Done:

100%

Estimated time:
0.00 h
Story Points:
Sprint:

History

#1 Updated by Roger Dahl almost 11 years ago

GMN currently instantiates HttpResponse with an iterator when returning objects from MNStorage.get(). This method is deprecated as of Django 1.5 and will stop working in Django 1.7.

From Django docs:

Passing iterators

Finally, you can pass HttpResponse an iterator rather than strings. If you use this technique, the iterator should return strings.

Passing an iterator as content to HttpResponse creates a streaming response if (and only if) no middleware accesses the HttpResponse.content attribute before the response is returned.
Changed in Django 1.5.

This technique is fragile and was deprecated in Django 1.5. If you need the response to be streamed from the iterator to the client, you should use the StreamingHttpResponse class instead.

As of Django 1.7, when HttpResponse is instantiated with an iterator, it will consume it immediately, store the response content as a string, and discard the iterator.

#2 Updated by Roger Dahl almost 11 years ago

  • Status changed from New to Closed
  • translation missing: en.field_remaining_hours set to 0.0

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 14.8 MB)