From 7920c57e17ea30ef44c7b3f703bc0f01f071d4ca Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 10 Aug 2011 19:00:49 +0200 Subject: [PATCH] clear icon cache --- pandora/item/models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandora/item/models.py b/pandora/item/models.py index fe87ef303..0e918ec02 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -975,6 +975,10 @@ class Item(models.Model): p = subprocess.Popen(cmd) p.wait() self.save() + icons = os.path.abspath(os.path.join(settings.MEDIA_ROOT, icon)) + icons = glob(icons.replace('.jpg', '*.jpg')) + for f in filter(lambda p: not p.endswith('/icon.jpg'), icons): + os.unlink(f) return icon def delete_item(sender, **kwargs):