[Twisted-Python] Making inlineCallback return a generator

Andrew Francis andrewfr_ice at yahoo.com
Sun Jan 27 13:05:18 EST 2008


Hello Nitro:

>@defer.inlineCallbacks
>def echo(self, x):
>     result = yield
client.getPage("http://localhost")
>     defer.returnValue(result)

According to the documentation, defer.returnValue()
returns a value. The problem in this scenario is that
the inlineCallback is being used in the following
context:

def SomeFunction(x):
    .
    .
    result = echo(x)
    .
    .
    .


you need to call return so that SomeFunction can get a
result. Think of SomeFunction being the underlying
code for a XmlRpc like protocol.

Cheers,
Andrew


      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping




More information about the Twisted-Python mailing list