From d94b5d1db0547b6d6f9141d1497e7b011e786ef6 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 14 Feb 2014 13:35:40 +0000 Subject: [PATCH] fix deleting documents --- pandora/document/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandora/document/models.py b/pandora/document/models.py index 1bb1dab1..1c34552c 100644 --- a/pandora/document/models.py +++ b/pandora/document/models.py @@ -3,6 +3,7 @@ from __future__ import division, with_statement import os import re +from glob import glob import subprocess from urllib import quote, unquote @@ -288,9 +289,9 @@ class Document(models.Model): def delete_document(sender, **kwargs): t = kwargs['instance'] if t.file: - folder = os.path.dirname(self.file.path) + folder = os.path.dirname(t.file.path) for f in glob('%s/*' % folder): - if f != self.file.path: + if f != t.file.path: os.unlink(f) t.file.delete() pre_delete.connect(delete_document, sender=Document)