[Twisted-Python] Another inlinecallback question

Nitro nitro at dr-code.org
Fri Jan 25 17:44:08 EST 2008


Am 25.01.2008, 23:39 Uhr, schrieb Andrew Francis <andrewfr_ice at yahoo.com>:

> Hi Folks:
>
> Another inclinecallback question.
>
> This time I am using PyAMF. Like xmlrpc, operations
> are method calls. So I have the following:
>
> def echo(self, x):
>         .
>         .
>     return result
>
> now from my PyAMF.operation, I want to do the
> following,
>
> @defer.inlineCallbacks
> def echo(self, x):
>     result = yield someCallResultingInADeferred()
>     return result
>
> the problem is that echo is now a generator, I can't
> write -
>
> return result - returns in generators can't take
> arguments.
>
> Once again, I am at a bit of loss about how to
> structure the code. Any suggestions are welcomed.

User defer.returnValue(result) instead of return.

-Matthias




More information about the Twisted-Python mailing list