Malcolm Tredinnick wrote:
> Any middleware that examines the content has to pull the content into
> memory in case it's an iterator. If they don't they're buggy because
> they're consuming the content ahead of the web server.

Agreed.

> But the default behaviour shouldn't
> require repetitive practices from normal, everyday middleware.

What exactly you mean by "repetitive practices"? I'm afraid my English 
fails me again, sorry!

> If I write a third-party middleware that behaves exactly as the
> content-length middleware does now, it won't work with something that
> can only be used as a generator. Since I won't know ahead of time what
> responses will be give to this middleware I am therefore forced to
> assume such a generator will be passed in. Thus, a change like this is
> saying that from now on, for all time, no middleware can look at the
> content of the response unless it fits into the very narrow profile in
> that ticket (matching one or other content types, etc).

If a middleware has to look at the content - it will. But why not make 
certain standard middleware not required to look at the content? They 
will be more useful then, and it doesn't imply, IMHO, that everyone 
should do it. No?

This got me thinking that the real problem is, in fact, a bit different. 
Right now middleware applies to all responses indifferently. But it 
looks like there are at least one more or less common case -- returning 
a big iterable -- for which most middleware don't make sense anyway and 
it's better handled as an exception. So may be we should devise a 
mechanism for such exceptions that won't require a middleware itself to 
be aware of it.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to