python-zk/kazoo — pull request #242 by stevemer (2014-09-04 19:55:08+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", blocking=False) as lock:
if lock.is_acquired:
# do something
```
------------------------------------------------------