Fixed an ugly bug that broke all deletions

This commit is contained in:
Daniel Quinn 2016-08-23 15:54:09 +01:00 committed by Daniel Quinn
parent 9e845ba813
commit 5662035efd

View File

@ -5,7 +5,7 @@ from subprocess import Popen
from django.conf import settings
from ..models import Correspondent, Tag
from ..models import Correspondent, Document, Tag
def logger(message, group):
@ -85,6 +85,10 @@ def run_post_consume_script(sender, document, **kwargs):
def cleanup_document_deletion(sender, instance, using, **kwargs):
if not isinstance(instance, Document):
return
for f in (instance.source_path, instance.thumbnail_path):
try:
os.unlink(f)