From 833032e5e8c7bc8795d293040571e7f5721eee8a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Nov 2014 17:59:19 +0100 Subject: [PATCH] Cleanup: use file-context --- webservice/bam/application/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/webservice/bam/application/__init__.py b/webservice/bam/application/__init__.py index f516e63..d1f4b86 100644 --- a/webservice/bam/application/__init__.py +++ b/webservice/bam/application/__init__.py @@ -183,12 +183,9 @@ class FileAPI(Resource): # TODO, once all files are uploaded, unpack and run the tasklist (copy, add, remove # files on a filesystem level and subsequently as svn commands) import zipfile - zipped_file = open(tmp_filepath, 'rb') - z = zipfile.ZipFile(zipped_file) - z.extractall(os.path.splitext(tmp_filepath)[0]) - zipped_file.close() - - + with open(tmp_filepath, 'rb') as zipped_file: + z = zipfile.ZipFile(zipped_file) + z.extractall(os.path.splitext(tmp_filepath)[0]) # TODO, dry run commit (using committ message) # Seems not easily possible with SVN