From 10001dde7b504e161a8dc3d3f1100431fed6b472 Mon Sep 17 00:00:00 2001 From: Tiago Rascazzi Date: Tue, 4 Jan 2022 13:55:13 -0500 Subject: [PATCH] Fix default export --- cookbook/integration/default.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cookbook/integration/default.py b/cookbook/integration/default.py index 91d5b22cf..39c0bc666 100644 --- a/cookbook/integration/default.py +++ b/cookbook/integration/default.py @@ -37,8 +37,9 @@ class Default(Integration): return 'recipe.json', JSONRenderer().render(export).decode("utf-8") def get_files_from_recipes(self, recipes, cookie): + export_zip_stream = BytesIO() + export_zip_obj = ZipFile(export_zip_stream, 'w') - files = [] for r in recipes: if r.internal and r.space == self.request.space: recipe_zip_stream = BytesIO() @@ -55,7 +56,7 @@ class Default(Integration): pass recipe_zip_obj.close() + export_zip_obj.writestr(str(r.pk) + '.zip', recipe_zip_stream.getvalue()) + export_zip_obj.close() - files.append([ str(r.pk) + '.zip', recipe_zip_stream.getvalue() ]) - - return files \ No newline at end of file + return [[ 'export.zip', export_zip_stream.getvalue() ]] \ No newline at end of file