image/appc: fix volume conversion and add tests
This commit is contained in:
parent
048f932094
commit
7a957c94c8
3 changed files with 24 additions and 3 deletions
|
@ -59,8 +59,16 @@ class JSONPathDict(object):
|
|||
def __getitem__(self, path):
|
||||
return self.get(path)
|
||||
|
||||
def __iter__(self):
|
||||
return self._object.itervalues()
|
||||
|
||||
def iterkeys(self):
|
||||
return self._object.iterkeys()
|
||||
|
||||
def get(self, path, not_found_handler=None):
|
||||
""" Returns the value found at the given path. Path is a json-path expression. """
|
||||
if self._object == {} or self._object is None:
|
||||
return None
|
||||
jsonpath_expr = parse(path)
|
||||
matches = jsonpath_expr.find(self._object)
|
||||
if not matches:
|
||||
|
@ -77,4 +85,3 @@ class JSONPathDict(object):
|
|||
|
||||
def keys(self):
|
||||
return self._object.keys()
|
||||
|
||||
|
|
Reference in a new issue