Commit 56e5b96f authored by Vincent Pelletier's avatar Vincent Pelletier

SimulationTool: Fix KeyError when group_by_list is not present.

Fixes a bug when select_list is present in related_key_dict_passthrough but
group_by_list is not.
Also, reduce the number of code paths.
parent bbc4f770
...@@ -1545,15 +1545,15 @@ class SimulationTool(BaseTool): ...@@ -1545,15 +1545,15 @@ class SimulationTool(BaseTool):
else: else:
group_by_id_list_append(group_by_id) group_by_id_list_append(group_by_id)
# Add related key group by # Add related key group by
if 'select_list' in new_kw.get("related_key_dict_passthrough", []): related_key_dict_passthrough = new_kw.get("related_key_dict_passthrough", {})
for group_by_id in new_kw["related_key_dict_passthrough"]['group_by_list']: group_by_list = related_key_dict_passthrough.get('group_by_list', [])
if group_by_id in new_kw["related_key_dict_passthrough"]["select_list"]: cannot_group_by = set(group_by_list).difference(
group_by_id_list_append(group_by_id) related_key_dict_passthrough.get('select_list', []),
else: )
# XXX-Aurel : to review & change, must prevent coming here before if cannot_group_by:
raise ValueError, "Impossible to group by %s" %(group_by_id) # XXX-Aurel : to review & change, must prevent coming here before
elif "group_by" in new_kw.get("related_key_dict_passthrough", []): raise ValueError("Impossible to group by %s" % (cannot_group_by, ))
raise ValueError, "Impossible to group by %s" %(new_kw["related_key_dict_passthrough"]['group_by_list'],) group_by_id_list += group_by_list
if len(group_by_id_list): if len(group_by_id_list):
def getInventoryListKey(line): def getInventoryListKey(line):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment