diff options
author | Alexander Dutton <dev@alexdutton.co.uk> | 2014-03-26 14:30:17 +0000 |
---|---|---|
committer | Alexander Dutton <dev@alexdutton.co.uk> | 2014-03-26 14:30:17 +0000 |
commit | 95a5b4672a60ecf298ea86ef501550fb0c032d52 (patch) | |
tree | e14638a784111da6ca29f65eaa8aff4d40b66565 /jsonpointer.py | |
parent | ac7c86e1bc35ba3e22bf5e68945d2c9316b754f9 (diff) | |
download | python-json-pointer-95a5b4672a60ecf298ea86ef501550fb0c032d52.tar.gz |
JsonPointer.from_parts should handle the empty path
[The RFC says](http://tools.ietf.org/html/rfc6901#page-5) that the path `""` points at the original document. However, passing `[]` to `from_parts()` results in a path of `"/"` (the same as when one passes `[""]`. This makes the empty list produce a pointer for the empty path.
Diffstat (limited to 'jsonpointer.py')
-rw-r--r-- | jsonpointer.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/jsonpointer.py b/jsonpointer.py index 4d65987..e4a5c81 100644 --- a/jsonpointer.py +++ b/jsonpointer.py @@ -283,7 +283,7 @@ class JsonPointer(object): parts = [str(part) for part in parts] parts = [part.replace('~', '~0') for part in parts] parts = [part.replace('/', '~1') for part in parts] - ptr = cls('/' + '/'.join(parts)) + ptr = cls(''.join('/' + part for part in parts)) return ptr |