[Twisted-web] Re: [Web-SIG] WSGI woes

Phillip J. Eby pje at telecommunity.com
Fri Sep 17 03:02:31 CEST 2004


At 08:39 PM 9/16/04 -0400, Donovan Preston wrote:

>On Sep 16, 2004, at 1:41 PM, Phillip J. Eby wrote:
>
>>     resume = environ['wsgi.pause_output']()
>>
>>Where 'resume' is then a callback function that can be invoked to resume 
>>iteration.  This keeps it to a single extension key, helps ensure the 
>>correct sequence of actions, and makes it easier to implement in some 
>>cases, while not making other cases any harder.
>
>Well, I guess I sparked some discussion here. Great! I am +1 on the above 
>construct, calling pause_output and yielding an empty string. I'm glad 
>this technique came up because I hadn't paid enough attention to the 
>environ dict and how it could be used to do something like this.
>
>I think with servers providing a pause_output callable like this, 
>asynchronous applications will be possible and the isolation between the 
>layers can be preserved. I am going to try writing some code using this 
>construct and provide further feedback after I do.

Keep in mind that this is proposed as an optional construct, so if the 
server doesn't provide it, the application iterable will either need to be 
okay being next()-ed repeatedly, or else "go synchronous" and either do the 
work in-thread or block on a queue from the I/O thread.

And, until I get some feedback on the other part of this (making 
'wsgi.input' an iterator too, and having a way to "pause until input"), I'm 
not ready to add this to the PEP as 'wsgi.pause_output'.  But again, 
nothing stops a server from providing e.g. a 'twisted.pause_output' 
extension API, with whatever semantics you'd like it to have.



More information about the Web-SIG mailing list