[Web-SIG] Proposed WSGI extensions for asynchronous servers

Christopher Stawarz cstawarz at csail.mit.edu
Mon May 12 16:35:09 CEST 2008


On May 12, 2008, at 12:01 AM, Ionel Maries Cristian wrote:

> My thinking is that the server *creates* the environ dictionary, so  
> it can just keep a reference to it and update it as needed.  Is  
> middleware allowed to replace environ with another dict instance  
> before passing it to the application?  I wasn't aware that this was  
> allowed, but if it is, then I see the problem.
>
> The solution would probably be for the application to pass a mutable  
> object (e.g. an empty list) to readable/writable that the server  
> could set a timeout flag on.
>
> How about a environ['x-wsgiorg.async'].timeout ? I do something like  
> that in cogen.

Or environ['x-wsgiorg.async.timeout'] could be an object whose truth  
value can be toggled by the server, like an instance of the following:

   class MutaBool(object):
       def __init__(self):
           self.val = False
       def __nonzero__(self):
           return self.val

Then there's no need for the server to change environ after starting  
the app.  I think that's probably the way to go.


Chris


More information about the Web-SIG mailing list