On Thu, Feb 18, 2010 at 12:00 PM, Russell Keith-Magee
<freakboy3...@gmail.com> wrote:
...
> benefit of using an iterator in the first place. So -- I suppose the
> bigger question that needs to be asked is what exactly is the use case
> for an iterable response? I mean, I understand the general benefit of
> using iterators and generators instead of rolled out lists, but what
> is the use case in a HTTP context?
>

>From my own experience, we have several web pages that either do a lot
of web service RPC calls (10-12k per request) to other services, or do
a smaller number of very expensive WS calls. Either way, this takes a
lot of time to do this, and so to avoid timeouts, we would iteratively
build up the page, yielding a small HTML comment every n-iterations,
depending on how fast etc the WS calls were.

In a similar manner, we also have some pages where we do some complex
data mining queries thru django's ORM. On these pages as well, we
would use an iterator based response to avoid timing out whilst
building the page. Since generating this data is very expensive time
wise, we use a modified CacheMiddleware to buffer and store the
generated page in the cache. Sample code is on ticket 6527 (1).

Cheers

Tom

(1) http://code.djangoproject.com/ticket/6527#comment:19

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

Reply via email to