From ec26151db15c241e29c7730dc12657434370ff67 Mon Sep 17 00:00:00 2001 From: kafkaf- Date: Fri, 14 Nov 2014 16:05:00 +0200 Subject: Removed unrelated changes to the contains method, reverted the exception handle --- jsonpointer.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'jsonpointer.py') diff --git a/jsonpointer.py b/jsonpointer.py index 02aa594..b3f0362 100644 --- a/jsonpointer.py +++ b/jsonpointer.py @@ -166,8 +166,7 @@ class JsonPointer(object): try: doc = self.walk(doc, part) - # Catching a broad exception to ensure the return of the default - except: + except JsonPointerException: if default is _nothing: raise else: @@ -250,7 +249,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 -- cgit v1.2.1