[Twisted-Python] waitForDeferred Question
Brian Granger
ellisonbg at gmail.com
Fri Mar 10 18:12:43 MST 2006
Hi,
I have a function that returns a Deferred. I need to have the result
of this Deferred returned in a (apparently) blocking/synchronous
manner:
def myfuncBlocking():
d = myfuncReturnsDeferred()
...
result =
return result
I need to be able to call this function like:
result = myfuncBlocking()
The question is how to get the result out of the Deferred() and make
it *look* like myfuncBlocking() has blocked. I have looked over the
waitForDeferred() docstrings and code, but it is still not obvious how
to use waitForDeferred() to accomplish this. The blockOn() capability
of the gthreadless.py module (in the sandbox) seems to accomplish what
I want, but I would like to use things that are in the main twisted
trunk. What is the best way to go about this?
Thanks
Brian
--
Brian Granger
Santa Clara University
ellisonbg at gmail.com
More information about the Twisted-Python
mailing list