Snippet List
Add RequestMiddleware to your MIDDLEWARE_CLASSES settings
Then, when you need request in special cases, call get_request(), which returns the request object.
This has to be used in very special cases.
- middleware
- threading
- request
- local
A decorator similar to `cache_page`, which will cache any function for any amount of time using the Django cache API.
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.
I posted a sample function which uses the [delicious API](http://www.djangosnippets.org/snippets/110/) in the function, also.
**Update**: It now also will put in a temporary 'in-process' variable (an instance of `MethodNotFinishedError`) in the cache while the function is processing. This will prevent the cache from calling the method again if it's still processing. This does not affect anything **unless you're using threads**.
- cache
- function
- threading
- threads
- thread
3 snippets posted so far.