summaryrefslogtreecommitdiff
path: root/zake/utils.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2014-08-30 22:34:00 -0700
committerJoshua Harlow <harlowja@gmail.com>2014-08-30 22:34:00 -0700
commit3a77780243af35a3823520535bc9b05f624fde12 (patch)
tree2def18093d1f5a6578dd6d1cfb2e29c5aca6d3f6 /zake/utils.py
parentdba8cbfe7a6a72877d364cea22a199cb3e75f539 (diff)
downloadzake-3a77780243af35a3823520535bc9b05f624fde12.tar.gz
Keep the trailing slash only for sequenced creates
Always keeping the trailing slash is not actually what zookeeper does, so only keep it if we are potentially making a sequenced node so that the sequenced nodes new path is correct.
Diffstat (limited to 'zake/utils.py')
-rw-r--r--zake/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/zake/utils.py b/zake/utils.py
index c79878a..c5817f8 100644
--- a/zake/utils.py
+++ b/zake/utils.py
@@ -28,10 +28,10 @@ def millitime():
return int(round(time.time() * 1000.0))
-def normpath(path):
+def normpath(path, keep_trailing=False):
"""Really normalize the path by adding a missing leading slash."""
new_path = k_paths.normpath(path)
- if path.endswith("/") and not new_path.endswith("/"):
+ if keep_trailing and path.endswith("/") and not new_path.endswith("/"):
new_path = new_path + "/"
if not new_path.startswith('/'):
return '/' + new_path