This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Contains utils for storing and retreiving values from threadlocals, and middleware for placing the current Django request in threadlocal storage.

Project Description
Setup/Usage
===========
Install using `pip install django-threadlocals`

Add "threadlocals.middleware.ThreadLocalMiddleware" to your MIDDLEWARE_CLASSES setting.
Then use it as follows:

Example usage:
--------------
`from threadlocals.threadlocals import get_current_request

request = get_current_request()`


Caveat Emptor
==================

Storing the request in threadlocals goes against several django core developers' strong inclinations against using threadlocals.
See [this thread on django-users](https://groups.google.com/forum/?fromgroups=#!topic/django-users/5681nX0YPgQ) for a more in-depth discussion.
We recommend you not do this unless you have a really good reason to do so. We feel like we had a really good
reason (the only one we've come across so far):
Having the request in threadlocals is the core piece that allowed us to build a true multi-tenant system on top of django where the site is resolved dynamically based on the current host,
and objects are filtered based on the current host. With the current version of django, this is nearly impossible to do without the request in threadlocals. This was a very significant and advanced undertaking, but we're happy with the results.


Tests
-----

To run tests:

python tester/manage.py test
Release History

Release History

This version
History Node

0.8

History Node

0.7.2

History Node

0.7.1

History Node

0.7

History Node

0.6

History Node

0.4.2

History Node

0.4.1

History Node

0.4

History Node

0.3

History Node

0.2

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-threadlocals-0.8.tar.gz (4.2 kB) Copy SHA256 Checksum SHA256 Source Sep 1, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting