Fix dict wrapper access to not raise an exception

This commit is contained in:
Joseph Schorr 2015-09-22 14:18:37 -04:00
parent 4a79311d26
commit 40f3b7137d

View file

@ -57,10 +57,7 @@ class JSONPathDict(object):
self._object = dict_value
def __getitem__(self, path):
def raise_exception():
raise KeyError('Unknown path: %s' % path)
return self.get(path, not_found_handler=raise_exception)
return self.get(path)
def get(self, path, not_found_handler=None):
""" Returns the value found at the given path. Path is a json-path expression. """