From 17586c1d2ab5756955e19ebf374926ce73ac9260 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 2 Feb 2014 06:35:04 +0000 Subject: [PATCH] cleanup document thumbnails --- pandora/document/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora/document/models.py b/pandora/document/models.py index 69f01c0e0..1e8ae8377 100644 --- a/pandora/document/models.py +++ b/pandora/document/models.py @@ -287,10 +287,10 @@ class Document(models.Model): def delete_document(sender, **kwargs): t = kwargs['instance'] if t.file: - if t.extension == 'pdf': - thumb = t.thumbnail() - if os.path.exists(thumb): - os.unlink(thumb) + folder = os.path.dirname(self.file.path) + for f in glob('%s/*' % folder): + if f != self.file.path: + os.unlink(f) t.file.delete() pre_delete.connect(delete_document, sender=Document)