[Twisted-web] Is there a way to implement a deferred sequence?

Dmitry Kozhevin dmitrikozhevin at gmail.com
Fri Apr 10 06:27:42 EDT 2009


Alexey, I thought you could use Trellis.

On Thu, Apr 9, 2009 at 6:30 PM,  <twisted-web at udmvt.ru> wrote:
> Greetings.
>
> I want a sequence which is Deferred with two callbacks:
>   one as usual - for the whole result called at the end of the sequence,
>   another - called for every element of the sequence (as they arrive).
>
> The number of elements is not known beforehand, so it is not a defer.DeferredList,
> but the idea is almost the same.
> To provide some interface to send items to the sequence, fire item callback for every
> item arrived and have main callback to be called at the end of the sequence.
>
> It could be used for example in AJAX web-applications that use Athena to
> simplify/automate the dynamic updates of some slowly arriving results (while in
> AJAX-supporting environment) and to gracefully fallback when javascript
> is not enabled/not desired.
>
> It could be deployed as using a slightly modified "sequence"-like renderer with
> "data" function returning this form of Deferred. The renderer will output
> some 'live' element immediately and then will append remotely it's contents
> as items arrive. Or will fallback to the usual builtin "sequence" renderer
> when AJAX is not desired.
>
> I think this approach will make it possible to hide all details into the
> renderer code.
>
> The same could be done to make items replace each other with the last being
> displayed as the final result...
>
> Or maybe it is already done in a different way?
> Or have I missed something, could anyone point me, please?
>
> Thanks for your time.
>
> --
> Alexey S.
>
> _______________________________________________
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
>



More information about the Twisted-web mailing list