On Mon, Mar 3, 2008 at 3:58 AM, Marcin Kasperski <[EMAIL PROTECTED]> wrote: > > > Anytime you did a blocking operation you'd have to use Twisted's > > callback style, which is a chain of functions where a normal program > > would have a single function. (Thus you have to pass what would > > normally be local variables as arguments, or put the chunks together > > in a class and use instance attributes for your "local variables".) > > Well, with inlineCallbacks it does not look so bad > > <hint> > > @defer.inlineCallbacks > def someFunction(): > a = 1 > b = yield deferredReturningFunction(a) > c = yield anotherDeferredReturningFunction(a, b) > defer.returnValue(c) > > </hint>
Yes, that's a possibility. I didn't mention it because I don't know how bulletproof that is yet, and some Twisted purists disdain it. So it needs to be seen as totally optional for Twisted programming, and not used in "generic" core libraries. Though a nonthreaded WSGI adapter could certainly declare that it depends on it. > Would be interesting if somebody tried to provide WSGI server which > in addition to standard api, would handle deferred as a result. > Although a lot of things would need to be adapted... That would be more complicated than two dedicated servers, one that always threads and the other that never does. -- Mike Orr <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
