Enclose queue_file writing in with statement so that it's closed correctly.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 23 Apr 2011 18:15:09 +0000 (13:15 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 23 Apr 2011 18:15:09 +0000 (13:15 -0500)
mediagoblin/submit/views.py

index 1d93e07051ccf52de5f84d7e83097558692b63f4..542017962731039ece30aef9d02fa08affe883f0 100644 (file)
@@ -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)