def process_path_value(cls, val, must_exist, can_have_subdict):
"""
does the relative path processing for a value from the dictionary,
which can be a string, a list of strings, or a list of strings
and "tagged" strings (sub-dictionaries whose values are strings)
:param val: the value we are processing, for error messages
:param must_exist: whether there must be a value
:param can_have_subdict: whether the value can be a tagged string
"""
if isinstance(val, six.string_types):
return cls.relative_path(val, must_exist)
elif isinstance(val, list):
vals = []
for entry in val:
if can_have_subdict and isinstance(entry, dict):
for subkey, subval in six.iteritems(entry):
vals.append({subkey: cls.relative_path(subval, must_exist)})
else:
vals.append(cls.relative_path(entry, must_exist))
return vals
评论列表
文章目录