[Twisted-Python] Looking for an answer...
Chaz.
eprparadocs at gmail.com
Sun Apr 29 09:36:42 MDT 2007
I have programmed very traditional systems passed on fork and pthreads
and have used state machine systems. Last year I started working with
Twisted Matrix. Each has their appropriate application.
I started thinking about how to implement the following in Twisted, and
realized I don't know if it is possible. I thought I would ask the list
to find out if someone can come up with an answer.
Suppose I have a sequence of instructions, some of which can take a long
time. For example in a non-Twisted Matrix system I would do:
....do some computation....
proxy = xmlrpc.Proxy("http://....")
proxy.CallRemote(....)
... take the results of the CallRemote and use them...
In this example I assume CallRemote() only returns a result when it has
completed.
In the Twisted Matrix system I would do something like:
...do some computation....
proxy = twisted.web.xmlrpc.Proxy("http://...")
defer = proxy.CallRemote(...)
defer.addErrback(fcs_storeErr,...)
defer.addCallback(fcs_storeDone,...)
And I would define fcs_StoreErr() and fcs_storeDone(). In
fcs_storeDone() I would take the results from the CallRemote() and
process them.
My question is easy (the answer might be hard):
Can I emulate the non-Twisted example in the Twisted Matrix
system. In other words can I create something like CallRemote() which
returns only there is a result to process and get away from having to
explicitly use a defer?
Peace,
Chaz
More information about the Twisted-Python
mailing list