Allow to specify a place where to unpack zip data

Now unpack_zip_archive_in_memory always unpacks data in
folder called 'content'. To add more flexibility we add
new parameter that defines where to unpack the data.

Change-Id: Ieb2f24776293a1890d755cddc458511b16f8eb82
Mike Fedosin 6 years ago
parent dd61d8fc53
commit 5ef746ab9e

@ -102,12 +102,13 @@ def upload_content_file(context, af, data, blob_dict, key_name,
af.update_blob(context,, blob_dict, getattr(af, blob_dict))
def unpack_zip_archive_in_memory(context, af, fd):
"""Unpack zip archive in memory.
def unpack_zip_archive_in_memory(context, af, field_name, fd):
"""Unpack zip archive in memory and write its content to artifact folder.
:param context: user context
:param af: artifact object
:param fd: file
:param field_name: blob dict name where to unpack the data
:param fd: zip archive
:return io.BytesIO object - simple stream of in-memory bytes, None
flobj = io.BytesIO(
@ -122,6 +123,6 @@ def unpack_zip_archive_in_memory(context, af, fd):
if not name.endswith('/'):
context, af, utils.BlobIterator(,
'content', name)
field_name, name)
return flobj, None