andymccurdy/redis-py — pull request #492 by chillipino (2014-06-06 08:46:45+00:00)
Title: restore default Lock token storage, add toggle to make it thread-local

after thinking about this a bit, always putting the token in thread local storage makes it impossible to intentionally acquire a lock that's shared throughout the process. it's likely that existing code will depend on the [previous behavior](http://xkcd.com/1172/), so i think we should control it with a toggle.

this change adds a `thread_local=False` parameter to `Lock.__init__()` and `StrictRedis.lock()`, and only puts the token in thread-local storage if the parameter is `True`. i'm open to suggestions if you don't like the way this was done (i'm a bit iffy on the `dummy` class, myself).