<div class="gmail_quote">2012/2/20 Chris McDonough <span dir="ltr">&lt;<a href="mailto:chrism@plope.com">chrism@plope.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Mon, 2012-02-20 at 17:39 -0500, PJ Eby wrote:<br>
&gt; The standard way to do this would be to define an &quot;optional server<br>
&gt; extension&quot; API supplied in the environ; for example, a<br>
&gt; &#39;x-wsgiorg.register_shutdown&#39; function.<br>
<br>
</div>Unlikely, AFACIT, as shutdown may happen when no request is active.<br>
Even if this somehow happened to not be the case, asking the application<br>
to put it in the environ is not useful, as the environ can&#39;t really be<br>
relied on to retain values &quot;up&quot; the call stack.<br></blockquote><div><br></div><div>&quot;Optional server extension APIs&quot; are things that the server puts in the environ, not things the app puts there.  That&#39;s why it&#39;s &#39;register_shutdown&#39;, e.g. environ[&#39;x-wsgiorg.register_shutdown&#39;](shutdown_function).  </div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
- C<br>
<div><div></div><div class="h5"><br>
<br>
&gt;   The <a href="http://wsgi.org" target="_blank">wsgi.org</a> wiki used to be the place to propose these sorts of<br>
&gt; things for standardization, but it appears to no longer be a wiki, so<br>
&gt; the mailing list is probably a good place to discuss such a proposal.<br>
&gt;<br>
&gt; On Mon, Feb 20, 2012 at 2:30 PM, Tarek Ziadé &lt;<a href="mailto:ziade.tarek@gmail.com">ziade.tarek@gmail.com</a>&gt;<br>
&gt; wrote:<br>
&gt;         oops my examples were broken, should be:<br>
&gt;<br>
&gt;         def hello_world_app(environ, start_response): status = &#39;200<br>
&gt;         OK&#39; # HTTP Status headers = [(&#39;Content-type&#39;, &#39;text/plain&#39;)]<br>
&gt;         start_response(status, headers) return [&quot;Hello World&quot;]<br>
&gt;<br>
&gt;         def shutdown():   # or maybe something else as an argument I<br>
&gt;         don&#39;t know<br>
&gt;         do_some_cleanup()<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;         and:<br>
&gt;<br>
&gt;         $ gunicorn myapp:hello_world_app myapp:shutdown<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;         Cheers<br>
&gt;         Tarek<br>
&gt;<br>
&gt;         _______________________________________________<br>
&gt;         Web-SIG mailing list<br>
&gt;         <a href="mailto:Web-SIG@python.org">Web-SIG@python.org</a><br>
&gt;         Web SIG: <a href="http://www.python.org/sigs/web-sig" target="_blank">http://www.python.org/sigs/web-sig</a><br>
&gt;         Unsubscribe:<br>
&gt;         <a href="http://mail.python.org/mailman/options/web-sig/pje%" target="_blank">http://mail.python.org/mailman/options/web-sig/pje%</a><br>
&gt;         <a href="http://40telecommunity.com" target="_blank">40telecommunity.com</a><br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Web-SIG mailing list<br>
&gt; <a href="mailto:Web-SIG@python.org">Web-SIG@python.org</a><br>
&gt; Web SIG: <a href="http://www.python.org/sigs/web-sig" target="_blank">http://www.python.org/sigs/web-sig</a><br>
</div></div>&gt; Unsubscribe: <a href="http://mail.python.org/mailman/options/web-sig/chrism%40plope.com" target="_blank">http://mail.python.org/mailman/options/web-sig/chrism%40plope.com</a><br>
<br>
<br>
</blockquote></div><br>