Implement queue dir delete for proc_state.delete_queue_file
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Mon, 8 Apr 2013 14:12:32 +0000 (16:12 +0200)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Mon, 8 Apr 2013 14:12:32 +0000 (16:12 +0200)
Implement queue dir deleting in the
proc_state.delete_queue_file helper function.

mediagoblin/processing/__init__.py

index 02462567d5464b2bd91f5fb35ae4a2f063143647..a1fd3fb74f869bf28f13a49261bd96f23e158f05 100644 (file)
@@ -111,8 +111,13 @@ class ProcessingState(object):
         self.entry.media_files[keyname] = target_filepath
 
     def delete_queue_file(self):
+        # Remove queued media file from storage and database.
+        # queued_filepath is in the task_id directory which should
+        # be removed too, but fail if the directory is not empty to be on
+        # the super-safe side.
         queued_filepath = self.entry.queued_media_file
-        mgg.queue_store.delete_file(queued_filepath)
+        mgg.queue_store.delete_file(queued_filepath)      # rm file
+        mgg.queue_store.delete_dir(queued_filepath[:-1])  # rm dir
         self.entry.queued_media_file = []