diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-02-12 07:08:23 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-02-12 07:08:23 +0000 |
commit | c15b95d15cfb0481f6646762cb70687227fa1028 (patch) | |
tree | 5ed48c13ef7abd2633da75bfa6be6aad005a9a55 | |
parent | 56edc108ab409d1648e8a715d2c6747869b83e08 (diff) | |
parent | 59771ddc6d16468c5e2010ea16f2be552f02a679 (diff) | |
download | taskflow-c15b95d15cfb0481f6646762cb70687227fa1028.tar.gz |
Merge "Let the multi-lock convert the provided value to a tuple"
-rw-r--r-- | taskflow/utils/lock_utils.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/taskflow/utils/lock_utils.py b/taskflow/utils/lock_utils.py index 648d6bb..ea2023e 100644 --- a/taskflow/utils/lock_utils.py +++ b/taskflow/utils/lock_utils.py @@ -80,9 +80,11 @@ def locked(*args, **kwargs): @six.wraps(f) def wrapper(self, *args, **kwargs): - lock = getattr(self, attr_name) - if isinstance(lock, (tuple, list)): - lock = MultiLock(locks=list(lock)) + attr_value = getattr(self, attr_name) + if isinstance(attr_value, (tuple, list)): + lock = MultiLock(attr_value) + else: + lock = attr_value with lock: return f(self, *args, **kwargs) |