From 402ff8830378ed95de69201b1f97718fad2eec5d Mon Sep 17 00:00:00 2001 From: Marcin Koziej Date: Wed, 26 Oct 2011 17:07:15 +0200 Subject: [PATCH] zipfile does not support __exit__ --- apps/catalogue/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/catalogue/utils.py b/apps/catalogue/utils.py index 369656e40..07458c9ac 100644 --- a/apps/catalogue/utils.py +++ b/apps/catalogue/utils.py @@ -108,9 +108,12 @@ def create_zip(paths, zip_slug): with LockFile(zip_path, zip_slug): if not path.exists(path.join(zip_path, zip_filename)): - with ZipFile(path.join(zip_path, zip_filename), 'w') as zipf: + zipf = ZipFile(path.join(zip_path, zip_filename), 'w') + try: for p in paths: zipf.write(p, path.basename(p)) + finally: + zipf.close() return 'zip/' + zip_filename -- 2.20.1