[Twisted-Python] Learning about IPushProducer

Jean-Paul Calderone exarkun at divmod.com
Fri Mar 16 13:29:45 EDT 2007

On Fri, 16 Mar 2007 11:48:53 -0400, "Rutt, Benjamin" <benjamin.rutt at gs.com> wrote:
>BTW, how was it that my pauseProducing ever got invoked below?  after
>all I registered my producer (erroneously, no doubt since it implements
>IPushProducer) as a pull producer by using the 2nd argument of 'False'
>self.consumer.registerProducer(self, False)
>If indeed it's registered as a pull producer I wouldn't think its pause
>should ever be called. Does twisted actually use the type of the class
>to see what to call?  Or getattr(class,'pauseProducing') or somesuch?
>If so, what's the purpose of 'True' or 'False' during registration?
>from the docs:
>	registerProducer(producer, streaming)
>	So that a consumer can invoke methods on a producer, the
>consumer needs to be told about the producer. This is done with the
>registerProducer method. The first argument is either a IPullProducer or
>IPushProducer provider; the second argument indicates which of these
>interfaces is provided: True for push producers, False for pull

This was a bug in one of the consumer implementations in Twisted (#2286).
It's been fixed since Twisted 2.5, so this won't happen in Twisted 2.6.


More information about the Twisted-Python mailing list