Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/apps/bandwagon/tasks.py
diff options
context:
space:
mode:
Diffstat (limited to 'apps/bandwagon/tasks.py')
-rw-r--r--apps/bandwagon/tasks.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/bandwagon/tasks.py b/apps/bandwagon/tasks.py
index a51c33b..aafae43 100644
--- a/apps/bandwagon/tasks.py
+++ b/apps/bandwagon/tasks.py
@@ -2,6 +2,7 @@ import logging
import math
import os
+from django.conf import settings
from django.db.models import Count
from celeryutils import task
@@ -48,6 +49,20 @@ def resize_icon(src, dst):
except Exception, e:
log.error("Error saving collection icon: %s" % e)
+@task
+def delete_icon(dst):
+ log.info('[1@None] Deleting icon: %s.' % dst)
+
+ if not dst.startswith(settings.COLLECTIONS_ICON_PATH):
+ log.error("Someone tried deleting something they shouldn't: %s"
+ % dst)
+ return
+
+ try:
+ os.remove(dst)
+ except Exception, e:
+ log.error("Error deleting icon: %s" % e)
+
@task
def collection_meta(*ids, **kw):