def get_value(my, path):
parts = path.split("/")
current = my.package
for part in parts:
current = current.get(part)
# explict None comparison: empty string should go through
if current == None:
raise HandlerException("Part [%s] does not exist in package" % part)
# if this is still a dictionary and it has __VALUE__ in it, the
# get that value
if type(current) == types.DictionaryType and current.has_key("__VALUE__"):
current = current.get("__VALUE__")
if type(current) == types.ListType:
return current[0]
else:
return current
评论列表
文章目录