djangosnippets.org: Latest snippets tagged with 'thread'http://djangosnippets.org/tags/thread/2009-06-17T11:43:53.868766-05:00Test Server Thread
2009-06-17T11:43:53.868766-05:00adamloftshttp://djangosnippets.org/snippets/1570/<p>This class runs a django test server in another thread. This is very useful for e.g. selenium integration. Simple to integrate into django test framework.</p>
<p>Usage:</p>
<pre><code>server = TestServerThread("127.0.0.1", "8081")
server.start()
# Run tests e.g.
req = urllib.urlopen("http://127.0.0.1:8081")
contents = req.read()
server.stop()
</code></pre>
<p>ps. I don't actually double space my code …</p>
Freely redistributableCache any function (with its arguments)
2007-04-25T16:31:18.809648-05:00bkroezehttp://djangosnippets.org/snippets/202/<p>Please see original snippet for commentary, all I did was add the caching of the arguments.</p>
<p>http://www.djangosnippets.org/snippets/109/</p>
Freely redistributableCache Any Function
2007-03-14T23:52:29.556905-05:00jeffwheelerhttp://djangosnippets.org/snippets/109/<p>A decorator similar to <code>cache_page</code>, which will cache any function for any amount of time using the Django cache API.</p>
<p>I use this to cache API calls to remote services like Flickr in my view, to prevent having to hit their servers on every request.</p>
<p>I posted a sample …</p>
Freely redistributable