Commit 0c75495b authored by Mihai Patrascoiu's avatar Mihai Patrascoiu
Browse files

In build_submission, use the newly created 'params' object instead of the kwargs reference.

When 'params' are passed-in, make a copy to avoid modifying the passed-in argument.
parent 01da9671
......@@ -29,10 +29,9 @@ class Submitter(object):
@staticmethod
def build_submission(transfers=None, delete=None, staging=None, params=None, **kwargs):
job = dict()
job['params'] = dict()
if params:
job['params'] = params
else:
job['params'] = dict()
job['params'].update(params)
job['params'].update(kwargs)
if delete:
......@@ -41,18 +40,18 @@ class Submitter(object):
job['staging'] = staging
if transfers:
job['files'] = transfers
if 'checksum' in kwargs:
if 'checksum' in job['params']:
for f in job['files']:
if 'checksum' not in f:
f['checksum'] = kwargs['checksum']
f['checksum'] = job['params']['checksum']
del job['params']['checksum']
if 'filesize' in kwargs:
if 'filesize' in job['params']:
for f in job['files']:
f['filesize'] = kwargs['filesize']
f['filesize'] = job['params']['filesize']
del job['params']['filesize']
if 'file_metadata' in kwargs:
if 'file_metadata' in job['params']:
for f in job['files']:
f['metadata'] = kwargs['file_metadata']
f['metadata'] = job['params']['file_metadata']
del job['params']['file_metadata']
return json.dumps(job, indent=2)
......
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