Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#1569 closed enhancement (fixed)

[patch] Streaming HttpResponse

Reported by: Maniac <Maniac@…> Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Maniac@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

HttpResponse should be able to accept not only strings but any iterator. This is most useful for streaming files without loading them into memory.

Patches follow.

Attachments (6)

1569.trunk.diff (5.1 KB) - added by Maniac <Maniac@…> 11 years ago.
Patch for trunk
1569.m-r.diff (5.1 KB) - added by Maniac <Maniac@…> 11 years ago.
Patch for magic-removal branch
1569.trunk.2.diff (4.9 KB) - added by Maniac <Maniac@…> 11 years ago.
More correct patch for trunk
1569.m-r.2.diff (5.0 KB) - added by Maniac <Maniac@…> 11 years ago.
More correct patch for magic-removal
1569.unicode.trunk.diff (2.2 KB) - added by Maniac <Maniac@…> 11 years ago.
Unicode-aware iterator (trunk)
1569.unicode.m-r.diff (2.2 KB) - added by Maniac <Maniac@…> 11 years ago.
Unicode-aware iterator (magic-removal)

Download all attachments as: .zip

Change History (15)

Changed 11 years ago by Maniac <Maniac@…>

Attachment: 1569.trunk.diff added

Patch for trunk

Changed 11 years ago by Maniac <Maniac@…>

Attachment: 1569.m-r.diff added

Patch for magic-removal branch

comment:1 Changed 11 years ago by Maniac <Maniac@…>

Cc: Maniac@… added
Summary: Streaming HttpResponse[patch] Streaming HttpResponse

Changed 11 years ago by Maniac <Maniac@…>

Attachment: 1569.trunk.2.diff added

More correct patch for trunk

Changed 11 years ago by Maniac <Maniac@…>

Attachment: 1569.m-r.2.diff added

More correct patch for magic-removal

comment:2 Changed 11 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [2639]) Fixed #1569 -- HttpResponse now accepts iterators. Thanks, Maniac

comment:3 Changed 11 years ago by django@…

Unicode is not getting encoded anymore - the content property does the encoding but this is bypassed by accessing the iterator in the handlers.

comment:4 Changed 11 years ago by Adrian Holovaty

Resolution: fixed
Status: closedreopened

Good point, Kieran. I'm reopening.

Changed 11 years ago by Maniac <Maniac@…>

Attachment: 1569.unicode.trunk.diff added

Unicode-aware iterator (trunk)

Changed 11 years ago by Maniac <Maniac@…>

Attachment: 1569.unicode.m-r.diff added

Unicode-aware iterator (magic-removal)

comment:5 Changed 11 years ago by Maniac <Maniac@…>

Oops, sorry. I missed this when refactoring 2nd version of the patch.

New patch turns public iterator that is given to a handler into a generator converting unicode to default_charset if necessary.

Kieran, thanks for quick catch!

comment:6 Changed 11 years ago by Adrian Holovaty

Resolution: fixed
Status: reopenedclosed

(In [2675]) Fixed #1569 -- Made streaming HttpResponse unicode-aware

comment:7 Changed 11 years ago by Maniac <Maniac@…>

Thanks Adrian!

How about the second half of this thing in #1484 ? I've updated those patches for the current code.

comment:8 Changed 11 years ago by Adrian Holovaty

Good things (and commits) come to those who are patient.

comment:9 Changed 11 years ago by Maniac <Maniac@…>

Ok, I got it :-)

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