Working resolver integration with buildSelect3 exception
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -2,8 +2,9 @@ def resolveItem(action, item):
|
||||
resolved = {}
|
||||
label = action.resolve["label"]
|
||||
targetkeys = action.resolve["targetkeys"]
|
||||
|
||||
#print(item)
|
||||
target = item
|
||||
|
||||
for key in targetkeys:
|
||||
target = target[key]
|
||||
|
||||
@@ -20,3 +21,29 @@ def resolveItem(action, item):
|
||||
#print(resolved[label])
|
||||
|
||||
return resolved
|
||||
|
||||
def resolveItem2(action, item, outputs):
|
||||
#resolved = {}
|
||||
label = action.resolve["label"]
|
||||
targetkeys = action.resolve["targetkeys"]
|
||||
#print(item)
|
||||
target = item
|
||||
|
||||
for key in targetkeys:
|
||||
target = target[key]
|
||||
|
||||
#resolved[label] = target
|
||||
|
||||
#for label, keys in action.resolve.items():
|
||||
#target = item
|
||||
|
||||
#print(target)
|
||||
#for key in keys:
|
||||
#target = target[key]
|
||||
|
||||
#resolved[label] = target
|
||||
#print(resolved[label])
|
||||
|
||||
outputs[label] = target
|
||||
#print("Resolver DEBUG", target, outputs[label])
|
||||
return outputs
|
||||
|
||||
@@ -66,8 +66,41 @@ def buildSelect2(action, outputs):
|
||||
#select_data.append(item)
|
||||
|
||||
def buildSelect3(action, outputs):
|
||||
#print(outputs)
|
||||
try:
|
||||
select_data = []
|
||||
|
||||
target = outputs[action.select["source"]]
|
||||
includekey = action.select["include"]["key"]
|
||||
includevalue = action.select["include"]["value"]
|
||||
excludekey = action.select["exclude"]["key"]
|
||||
excludevalue = action.select["exclude"]["value"]
|
||||
|
||||
|
||||
for item in target:
|
||||
include_match = True
|
||||
exclude_match = True
|
||||
|
||||
if includekey:
|
||||
include_match = item[includekey] == includevalue
|
||||
|
||||
if excludekey:
|
||||
exclude_match = item[excludekey] != excludevalue
|
||||
|
||||
if include_match and exclude_match:
|
||||
select_data.append(item)
|
||||
|
||||
|
||||
outputs[action.select["source"]] = select_data
|
||||
print(select_data)
|
||||
return select_data, action, outputs
|
||||
except (KeyError, TypeError):
|
||||
return select_data, action, outputs
|
||||
|
||||
def buildSelect4(action, outputs):
|
||||
#print(outputs)
|
||||
select_data = []
|
||||
|
||||
target = outputs[action.select["source"]]
|
||||
#selectmethod = action.select["selectmethod"]
|
||||
includekey = action.select["include"]["key"]
|
||||
|
||||
Reference in New Issue
Block a user