[Twisted-Python] Stackless Python Examples Re: InlineCallback Friendly ?
andrewfr_ice at yahoo.com
Sat Apr 19 14:47:38 EDT 2008
--- Andrew Francis <andrewfr_ice at yahoo.com> wrote:
>The only kind of dispatcher which is really hostile
>towards inlineCallbacks is the kind which is
>hostile towards Deferreds in general - ie, one which
>requires a return value and does not support
>Once again Jean-Paul, I find your explanation super
>helpful and save me time going down the wrong path.
Based on Jean-Paul's explanation, here are some code
snippets showing how to handle other protocols with
Stackless Python and Twisted. This is a continuation
of the technique I used in "Adventures" to prevent the
reactor from deadlocking.
Currently I am rethinking the techniques - I believe
there is a way to reduce spawning tasklets - not that
tasklets are all that expensive....
Here is an example with resources adapted from the Abe
Fettig example on page 48 of "Twisted Network
Programming Essentials." I am still getting my feet
wet with resources. I intend to use this to help
prototype REST support in WS-BPEL.
message = """
def render(self, request):
self.request = request
and here is one with PyAMF .2
(I remember sketching this one out on a napkin at
self.request = None
def __echo__(self, request, deferred, y):
print "=>", request, deferred, y
def echo(self, request, y):
print "=>", request, y
deferred = defer.Deferred()
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
More information about the Twisted-Python