Message: 2
Date: Mon, 30 Mar 2009 11:10:48 -0400
From: "Doug Farrell" <[email protected]>
Subject: [Twisted-Python] RE: how to create state machines?
To: <[email protected]>
Message-ID:
<318f79422adc5041a93343721f84474d01a8b...@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")
deferred.addCallback(processPage)
>rather than this:
>deferred = defer.deferred()
Sometimes you want to create your own deferred and trigger it with a
callback().
Cheers,
Andrew
_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python