[Twisted-Python] RE: how to create state machines?

Andrew Francis andrewfr_ice at yahoo.com
Mon Mar 30 13:37:39 EDT 2009

Message: 2
Date: Mon, 30 Mar 2009 11:10:48 -0400
From: "Doug Farrell" <dfarrell at mypublisher.com>
Subject: [Twisted-Python] RE: how to create state machines?
To: <twisted-python at twistedmatrix.com>
    <318F79422ADC5041A93343721F84474D01A8BD68 at exchange.mypublisher.local>
Content-Type: text/plain;    charset="us-ascii"

>[Doug Farrell] Thank you very much for your detailed response,

You are welcome Doug.

>One thing I'm still a little confused by in your reply is how you're
>getting the deferred instance. Is there a particular reason your example
>does this:

>deferred = someOtherFunctionThatReturnsADeferred()

Yes. There are Twisted methods that return a Deferred. For instance,  client.getPage() or in the case of a XMLRPC client, proxy.callRemote(). 

def processPage(data):
    # do stuff with the web page here

deferred = client.getPage("http://wwww.google.com")

>rather than this:
>deferred = defer.deferred()

Sometimes you want to create your own deferred and trigger it with a callback(). 


More information about the Twisted-Python mailing list