Skip to content

Commit

Permalink
More correct file_data handling in populators.py.
Browse files Browse the repository at this point in the history
Any of file_N|file_data fields can have attached data.
  • Loading branch information
jmchilton committed May 16, 2018
1 parent 14cfb26 commit 95962d9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/base/populators.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,14 @@ def get_remote_files(self, target="ftp"):
return self._get("remote_files", data={"target": target}).json()

def run_tool_payload(self, tool_id, inputs, history_id, **kwds):
if "files_0|file_data" in inputs:
kwds["__files"] = {"files_0|file_data": inputs["files_0|file_data"]}
del inputs["files_0|file_data"]
# Remove files_%d|file_data parameters from inputs dict and attach
# as __files dictionary.
for key, value in list(inputs.items()):
if key.startswith("files_") and key.endswith("|file_data"):
if "__files" not in kwds:
kwds["__files"] = {}
kwds["__files"][key] = value
del inputs[key]

return dict(
tool_id=tool_id,
Expand Down

0 comments on commit 95962d9

Please sign in to comment.