From 0a0ff8da90d39d1f339e4a615adf302208caeefd Mon Sep 17 00:00:00 2001 From: Daniel Quinn Date: Tue, 23 Aug 2016 15:54:09 +0100 Subject: [PATCH] Fixed an ugly bug that broke all deletions --- src/documents/signals/handlers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/documents/signals/handlers.py b/src/documents/signals/handlers.py index 666bcbeb3..a4096154b 100644 --- a/src/documents/signals/handlers.py +++ b/src/documents/signals/handlers.py @@ -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)