From: Christopher Allan Webber Date: Sat, 23 Apr 2011 18:15:09 +0000 (-0500) Subject: Enclose queue_file writing in with statement so that it's closed correctly. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e21e7bfeb41a8ed6ab8fa3b27132efd84355ff36;p=mediagoblin.git Enclose queue_file writing in with statement so that it's closed correctly. --- diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py index 1d93e070..54201796 100644 --- a/mediagoblin/submit/views.py +++ b/mediagoblin/submit/views.py @@ -52,7 +52,8 @@ def submit_start(request): queue_file = request.app.queue_store.get_file( queue_filepath, 'wb') - queue_file.write(request.POST['file'].file.read()) + with queue_file: + queue_file.write(request.POST['file'].file.read()) # Add queued filename to the entry entry.setdefault('queue_files', []).add(queue_filepath)