diff options
author | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2013-02-18 14:46:28 +0100 |
---|---|---|
committer | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2013-02-18 14:55:42 +0100 |
commit | df5b142ab9bfc590f17768079104f6cfa2cd7bba (patch) | |
tree | f9cc60f8cbc1aa0bf8103f33794d5261933f8fa6 /mediagoblin/tools/files.py | |
parent | 61e39d90e58b8cea5c837d6da5731ab42127c642 (diff) | |
download | mediagoblin-df5b142ab9bfc590f17768079104f6cfa2cd7bba.tar.lz mediagoblin-df5b142ab9bfc590f17768079104f6cfa2cd7bba.tar.xz mediagoblin-df5b142ab9bfc590f17768079104f6cfa2cd7bba.zip |
Fix deleting media with attachments.
If one deletes a media with attachments, there have been
various problems:
1) If the file in the storage did not exist any more (maybe
because due to a previous deletion attempt?), the error
propagation failed, because the wrong thing was
gathered.
2) The attachment database entries were not deleted.
Using cascade for this, for now.
Also add a simple unit test, that tests both by having a
broken attachment on a media.
Diffstat (limited to 'mediagoblin/tools/files.py')
-rw-r--r-- | mediagoblin/tools/files.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mediagoblin/tools/files.py b/mediagoblin/tools/files.py index fd38f05e..848c86f2 100644 --- a/mediagoblin/tools/files.py +++ b/mediagoblin/tools/files.py @@ -37,7 +37,7 @@ def delete_media_files(media): mg_globals.public_store.delete_file( attachment['filepath']) except OSError: - no_such_files.append("/".join(attachment)) + no_such_files.append("/".join(attachment['filepath'])) if no_such_files: raise OSError(", ".join(no_such_files)) |