Thanks! Re: [Twisted-Python] Question about RequestHandlers
andrewfr_ice at yahoo.com
Fri Jan 25 14:05:59 EST 2008
AF>What I am unclear about is how to properly
AF>the programme to get the appropriate behaviour. I
AF>assuming this is possible. If so, what am I
>The part where you got confused is the part that
>inlineCallbacks, I think.
>You defined a gotPage callback which uses
>defer.returnValue. This is totally bogus. If you
>want a callback to return a value, then you just
>return it. defer.returnValue lets you specify the
>result of a Deferred returned by a call to a function
>decorated with inlineCallbacks.
>Your gotPage function has not been so decorated, so
>there's your bug I suspect.
No, I found the example for inlinecallback a wee
confusing. When I see the line
automatically thought I needed to create a deferred
and in the process, add a callback function. I also
misinterpreted the proviso about returnValue.
Perhaps it is just me, but maybe it would be better to
use a more concrete example using a twisted call.
That said, I have done what you suggested:
result = yield
except Exception, err:
log.err(err, "process getPage call
and this works beautifully. Thanks! inlinecallbacks
look really cool.....
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the Twisted-Python