Re: HttpResponse with file-like objects

2006-04-02 Thread Ivan Sagalaev
Istvan Albert wrote: >suppose one wants to return content created by two generators ... they >could wrap it themselves into a single one but why not write it both to >the response and let that iterate thru each, > > What if they want three? :-). I should say that it's still looking theoretical

Re: HttpResponse with file-like objects

2006-04-02 Thread Istvan Albert
> just can't imagine any practical application of this... suppose one wants to return content created by two generators ... they could wrap it themselves into a single one but why not write it both to the response and let that iterate thru each, if your code would support that it would end up be

Re: HttpResponse with file-like objects

2006-04-02 Thread Ivan Sagalaev
Istvan Albert wrote: >but it is not an arbitraty iterator one is writing to, it is the the >HttpResponse, why couldn't it handle new content being added just >because some content is present as an interator? once it exhausts the >original iterator it could continue on (if new content was added af

Re: HttpResponse with file-like objects

2006-04-02 Thread Istvan Albert
but it is not an arbitraty iterator one is writing to, it is the the HttpResponse, why couldn't it handle new content being added just because some content is present as an interator? once it exhausts the original iterator it could continue on (if new content was added after it) or why not let th

Re: HttpResponse with file-like objects

2006-04-01 Thread Ivan Sagalaev
Istvan Albert wrote: >2. I'm commenting here as an outsider, but looking at the patch it >seems that the _is_string attribute is unnecessary, all it seems to be >used only to forbid certain methods, > Yes, this is its intention. > like writing, but why not let them >happen? > > As I already an

Re: HttpResponse with file-like objects

2006-04-01 Thread Istvan Albert
Two observations: 1. It is hard to believe that Django does not already do this ... it is somewhat depressing to see that trivial behavior such as streaming output was never implemented 2. I'm commenting here as an outsider, but looking at the patch it seems that the _is_string attribute is unne

Re: HttpResponse with file-like objects

2006-04-01 Thread Ivan Sagalaev
Ivan Sagalaev wrote: >I'll create a ticket with a patch later today. I somehow missed that >looking at the code may help people understand things :-) > > Here it is: http://code.djangoproject.com/ticket/1569 Patches both for trunk and magic removal. --~--~-~--~~~--

Re: HttpResponse with file-like objects

2006-03-31 Thread Malcolm Tredinnick
On Sat, 2006-04-01 at 09:06 +0400, Ivan Sagalaev wrote: > Thanks for the reply, Malcolm! > > Malcolm Tredinnick wrote: > > >A relatively minor point: I would prefer to leave something like this > >method in place, since otherwise everybody has to implement it > >themselves if they care about HTT

Re: HttpResponse with file-like objects

2006-03-31 Thread Ivan Sagalaev
Thanks for the reply, Malcolm! Malcolm Tredinnick wrote: >A relatively minor point: I would prefer to leave something like this >method in place, since otherwise everybody has to implement it >themselves if they care about HTTP compliance. The problem is the >Accept-Charset header in the HTTP re

Re: HttpResponse with file-like objects

2006-03-31 Thread Malcolm Tredinnick
On Fri, 2006-03-31 at 15:47 +0400, Ivan Sagalaev wrote: > I'm working on a patch (actually I use it for about a week locally) that > allows one to put an iterator as a content for HttpResponse. This is > intended primarily for large file-like objects that are fed to the user > incrementally wit

HttpResponse with file-like objects

2006-03-31 Thread Ivan Sagalaev
I'm working on a patch (actually I use it for about a week locally) that allows one to put an iterator as a content for HttpResponse. This is intended primarily for large file-like objects that are fed to the user incrementally without reading entirely into memory. This also allows to invent s