python-zk/kazoo — pull request #228 by stevemer (2014-08-07 01:51:42+00:00)
Title: (#227) allow for usage of non-blocking locks inside with statements

Introduce an optional argument to __init__ allowing for specification of blocking behavior at instantiation while maintaining backwards compatibility.

This allows for use of non-blocking Locks inside with statements.

------------------------------------------------------
```
zk = KazooClient()
with zk.Lock("/lockpath", "my-identifier", default_locking=False) as lock:
if lock.is_acquired:
# do something
```
------------------------------------------------------