Fix deleting media with attachments.
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Mon, 18 Feb 2013 13:46:28 +0000 (14:46 +0100)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Mon, 18 Feb 2013 13:55:42 +0000 (14:55 +0100)
commitdf5b142ab9bfc590f17768079104f6cfa2cd7bba
treef9cc60f8cbc1aa0bf8103f33794d5261933f8fa6
parent61e39d90e58b8cea5c837d6da5731ab42127c642
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.
mediagoblin/db/models.py
mediagoblin/tests/test_misc.py
mediagoblin/tools/files.py