summaryrefslogtreecommitdiff
path: root/jsonpointer.py
diff options
context:
space:
mode:
Diffstat (limited to 'jsonpointer.py')
-rw-r--r--jsonpointer.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/jsonpointer.py b/jsonpointer.py
index ee7f266..02aa594 100644
--- a/jsonpointer.py
+++ b/jsonpointer.py
@@ -166,7 +166,8 @@ class JsonPointer(object):
try:
doc = self.walk(doc, part)
- except JsonPointerException:
+ # Catching a broad exception to ensure the return of the default
+ except:
if default is _nothing:
raise
else:
@@ -215,7 +216,7 @@ class JsonPointer(object):
else:
raise JsonPointerException("Document '%s' does not support indexing, "
- "must be dict/list or support __getitem__" % type(doc))
+ "must be mapping/sequence or support __getitem__" % type(doc))
def walk(self, doc, part):
@@ -249,7 +250,7 @@ class JsonPointer(object):
def contains(self, ptr):
""" Returns True if self contains the given ptr """
- return len(self.parts) > len(ptr.parts) and \
+ return len(self.parts) >= len(ptr.parts) and \
self.parts[:len(ptr.parts)] == ptr.parts
@property