aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/util.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-08-30 20:16:47 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2011-08-30 20:16:47 -0500
commit2886b340d33c8f5c9cef933089fc1fce525da6aa (patch)
treec0f86bbdb41b33bd97e92f19b751dad898daaa62 /mediagoblin/util.py
parent04a7b06d613dd3ab90cde4eb268087e28d92017c (diff)
parent502073f2bf65380be18b349a678ac075777889a4 (diff)
downloadmediagoblin-2886b340d33c8f5c9cef933089fc1fce525da6aa.tar.lz
mediagoblin-2886b340d33c8f5c9cef933089fc1fce525da6aa.tar.xz
mediagoblin-2886b340d33c8f5c9cef933089fc1fce525da6aa.zip
Merge remote branch 'remotes/jwandborg/f403_ability_to_delete'
Diffstat (limited to 'mediagoblin/util.py')
-rw-r--r--mediagoblin/util.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/mediagoblin/util.py b/mediagoblin/util.py
index ba4ac01e..27c81f3a 100644
--- a/mediagoblin/util.py
+++ b/mediagoblin/util.py
@@ -681,3 +681,18 @@ def render_404(request):
"""
return render_to_response(
request, 'mediagoblin/404.html', {}, status=400)
+
+def delete_media_files(media):
+ """
+ Delete all files associated with a MediaEntry
+
+ Arguments:
+ - media: A MediaEntry document
+ """
+ for handle, listpath in media['media_files'].items():
+ mg_globals.public_store.delete_file(
+ listpath)
+
+ for attachment in media['attachment_files']:
+ mg_globals.public_store.delete_file(
+ attachment['filepath'])