[Twisted-Python] Plugin Example - review appreciated

Thorne, Stephen stephen at thorne.id.au
Fri Jun 24 13:06:12 EDT 2011


On Fri, Jun 24, 2011 at 18:23,  <exarkun at twistedmatrix.com> wrote:
> Using the global reactor makes code less easily testable.  This isn't
> specific to plugins, you should avoid the global reactor in all your
> Twisted-using code.  Accept it as a parameter instead.

Ah, I did not do this successfully in my rewrite. I'd be interested to
see an example of the correct technique to use. Is this what you mean?

from twisted.internet import reactor
class SetupClass(service.Service):
    def doStart(self, reactor=reactor):
         reactor.callLater(3, self.done)

-- 
Regards,
Stephen.Thorne



More information about the Twisted-Python mailing list