summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Wickman <wickman@twitter.com>2013-07-24 11:15:54 -0700
committerBrian Wickman <wickman@twitter.com>2013-07-24 11:15:54 -0700
commit801023312bd688eb8cf5c5b7b83e664cb2cba7aa (patch)
tree26143e7ba451640903e014c0ac0510ae4508687b
parent5a935b34b02cea65ec3d232fd1eddca96dc33d97 (diff)
downloadkazoo-801023312bd688eb8cf5c5b7b83e664cb2cba7aa.tar.gz
create_async should do the unchrooting, not create
-rw-r--r--kazoo/client.py6
-rw-r--r--kazoo/tests/test_client.py5
2 files changed, 8 insertions, 3 deletions
diff --git a/kazoo/client.py b/kazoo/client.py
index 7ef878f..d8e473b 100644
--- a/kazoo/client.py
+++ b/kazoo/client.py
@@ -650,8 +650,8 @@ class KazooClient(object):
returns a non-zero error code.
"""
- return self.unchroot(self.create_async(path, value, acl=acl,
- ephemeral=ephemeral, sequence=sequence, makepath=makepath).get())
+ return self.create_async(path, value, acl=acl, ephemeral=ephemeral,
+ sequence=sequence, makepath=makepath).get()
def create_async(self, path, value=b"", acl=None, ephemeral=False,
sequence=False, makepath=False):
@@ -703,7 +703,7 @@ class KazooClient(object):
@wrap(async_result)
def create_completion(result):
try:
- return result.get()
+ return self.unchroot(result.get())
except NoNodeError:
if not makepath:
raise
diff --git a/kazoo/tests/test_client.py b/kazoo/tests/test_client.py
index 9364e13..5f289b0 100644
--- a/kazoo/tests/test_client.py
+++ b/kazoo/tests/test_client.py
@@ -377,6 +377,11 @@ class TestClient(KazooTestCase):
path = client.create(u("/\xe4hm"))
eq_(path, u("/\xe4hm"))
+ def test_create_async_returns_unchrooted_path(self):
+ client = self.client
+ path = client.create_async('/1').get()
+ eq_(path, "/1")
+
def test_create_invalid_path(self):
client = self.client
self.assertRaises(TypeError, client.create, ('a', ))