Popular recipes tagged "wsgi" but not "python"http://code.activestate.com/recipes/tags/wsgi-python/2012-07-04T21:03:32-07:00ActiveState Code RecipesDistributed lock manager for Python (Python)
2012-07-04T21:03:32-07:00pavelhttp://code.activestate.com/recipes/users/4171837/http://code.activestate.com/recipes/578194-distributed-lock-manager-for-python/
<p style="color: grey">
Python
recipe 578194
by <a href="/recipes/users/4171837/">pavel</a>
(<a href="/recipes/tags/distributed/">distributed</a>, <a href="/recipes/tags/lock/">lock</a>, <a href="/recipes/tags/locking/">locking</a>, <a href="/recipes/tags/locks/">locks</a>, <a href="/recipes/tags/manager/">manager</a>, <a href="/recipes/tags/socket/">socket</a>, <a href="/recipes/tags/thread/">thread</a>, <a href="/recipes/tags/threading/">threading</a>, <a href="/recipes/tags/wsgi/">wsgi</a>).
Revision 2.
</p>
<p>Distributed lock manager provides mutex(es) over network. It is used to synchronize processes running on different machines, e.g. WSGI processes in case of web applications. Lock object is compatible with threading.Lock and can be used as a context manager ("with statement"). It can be easily modified to use UNIX sockets instead of TCP/IP. Communication protocol is text based.</p>
<p>First start server process:</p>
<pre class="prettyprint"><code>$ chmod +x dlm.py
$ ./dlm.py
</code></pre>
<p>Usage:</p>
<pre class="prettyprint"><code>from dlm import LockClient
client = LockClient('localhost', 27272, 'client_name')
lock = client.mkLock('lock_name')
lock.acquire()
# critical section here...
lock.release()
# using context manager
with lock:
# critical section here...
</code></pre>
Function Pipelines (Python)
2011-05-15T19:38:13-07:00Alexandre Zanihttp://code.activestate.com/recipes/users/4177180/http://code.activestate.com/recipes/577696-function-pipelines/
<p style="color: grey">
Python
recipe 577696
by <a href="/recipes/users/4177180/">Alexandre Zani</a>
(<a href="/recipes/tags/events/">events</a>, <a href="/recipes/tags/pipelining/">pipelining</a>, <a href="/recipes/tags/wsgi/">wsgi</a>).
</p>
<p>Pipelines can be used to chain a series of functions to process a piece of data. For instance you can build a pipeline to process web requests easily including some middleware for instance.</p>
Function Pipelines (Python)
2011-05-22T20:39:05-07:00Rob Lhttp://code.activestate.com/recipes/users/4178061/http://code.activestate.com/recipes/577714-function-pipelines/
<p style="color: grey">
Python
recipe 577714
by <a href="/recipes/users/4178061/">Rob L</a>
(<a href="/recipes/tags/events/">events</a>, <a href="/recipes/tags/pipelining/">pipelining</a>, <a href="/recipes/tags/wsgi/">wsgi</a>).
</p>
<p>Alexandre Zani's recipe on function pipelines was useful. I wanted to change it to suit my needs.</p>
<p>Mostly I just wanted to add arbitrary functions and make the pipe line more list like in behavior.</p>
<p>(edit: typos)</p>
wsgi SPNEGO middleware (Python)
2009-12-28T09:36:18-08:00Sven Ludwighttp://code.activestate.com/recipes/users/4172687/http://code.activestate.com/recipes/576992-wsgi-spnego-middleware/
<p style="color: grey">
Python
recipe 576992
by <a href="/recipes/users/4172687/">Sven Ludwig</a>
(<a href="/recipes/tags/kerberos/">kerberos</a>, <a href="/recipes/tags/spnego/">spnego</a>, <a href="/recipes/tags/wsgi/">wsgi</a>, <a href="/recipes/tags/wsgi_middleware/">wsgi_middleware</a>).
</p>
<p>Kerberos Single Sign On wsgi middleware</p>
WSGI option parsing & type conversion (Python)
2009-05-28T16:32:11-07:00Brendan O'Connorhttp://code.activestate.com/recipes/users/4170520/http://code.activestate.com/recipes/576784-wsgi-option-parsing-type-conversion/
<p style="color: grey">
Python
recipe 576784
by <a href="/recipes/users/4170520/">Brendan O'Connor</a>
(<a href="/recipes/tags/option_parsing/">option_parsing</a>, <a href="/recipes/tags/wsgi/">wsgi</a>).
Revision 2.
</p>
<p>fetches named parameters from the WSGI querystring, plus defaults for missing values, and type conversions so you dont accidentally have strings when you want numbers.</p>