[Twisted-Python] Bug in t.w.w.WidgetPage

Sune Kirkeby sune-twisted at mel.interspace.dk
Wed Jan 2 17:33:51 EST 2002

[ Sune Kirkeby ]
> I think there might be a bug lurking in t.w.w.WidgetPage's
> handling of Deferreds.

And here is a patch to fix it.  The patch does away with Deferred
holding their positions in lst, instead a Deferred now hold a
sentinel, that is put into lst with the Deferred.

When we need the position in callback we go looking for the sentinel
the Deferred gave us.  This also allows us to stop keeping data we
have written to the request (i.e. lst now only holds the Deferreds
and strings that have not been sent).

Also, the patch adds NOT_DONE_YET support to WidgetPage.  This works
by Deferreds callback'ing with a tuple (NOT_DONE_YET,
partial_result) which is insert into lst before the Deferred.

So, now Deferreds can callback to WidgetPage multiple times with
partial results. (Not sure if this is abusing the Deferred protocol,
but it solves an itch I had :-).


Sune Kirkeby | Teori er når vi har forstået alting, men intet virker. Praksis
             | er når alting virker, men ingen forstår hvorfor. Hos os
             | er de to ting forenet: Intet virker og ingen forstår hvorfor!

More information about the Twisted-Python mailing list