[Web-SIG] A 'shutdown' function in WSGI

Simon Sapin simon.sapin at exyr.org
Tue Feb 21 11:07:06 CET 2012


Le 21/02/2012 10:31, Graham Dumpleton a écrit :
 > You do realise you are just reinventing context managers?
 >
 > With this 'application' do requests.

Indeed. I didn’t want to go too far from the initial "shutdown function" 
proposal, but actual context managers would be better.


Le 21/02/2012 10:38, Benoit Chesneau a écrit :
>> One might wonder if having access to process management should be part of
>> >  WSGI in the first place.
>> >
> that's the thing. This is no more a gateway. Like I said in my
> previous post, maybe having another spec describing a web app package
> would do the trick?

So a super-set of WSGI that is not just a gateway but also does process 
management?


@contextlib.contextmanager
def super_application(server_infos):
     with contextlib.closing(open_resource()) as resource:
         wsgi_callable = make_app(server_infos, resource)
         yield wsgi_callable

-- 
Simon Sapin


More information about the Web-SIG mailing list