comparison gpp/core/tasks.py @ 517:666147a2cc08

Moved the imports from the top of the file into the task function. This seemed to prevent some strange import errors that only occurred on the production server. I don't know if the problems were related to mod_wsgi or Python 2.5 or what.
author Brian Neal <bgneal@gmail.com>
date Thu, 15 Dec 2011 02:49:16 +0000
parents beda97542da8
children 5171a5e9353b
comparison
equal deleted inserted replaced
516:beda97542da8 517:666147a2cc08
2 Celery tasks for the core application. 2 Celery tasks for the core application.
3 3
4 """ 4 """
5 from celery.task import task 5 from celery.task import task
6 import django.core.mail 6 import django.core.mail
7 from django.core.management.commands.cleanup import Command as CleanupCommand
8 from forums.management.commands.forum_cleanup import Command as ForumCleanup
9 7
10 8
11 @task 9 @task
12 def add(x, y): 10 def add(x, y):
13 """ 11 """
31 def cleanup(): 29 def cleanup():
32 """ 30 """
33 A task to perform site-wide cleanup actions. 31 A task to perform site-wide cleanup actions.
34 32
35 """ 33 """
34 from django.core.management.commands.cleanup import Command as CleanupCommand
35 from forums.management.commands.forum_cleanup import Command as ForumCleanup
36 # Execute Django's cleanup command (deletes old sessions). 36 # Execute Django's cleanup command (deletes old sessions).
37 37
38 command = CleanupCommand() 38 command = CleanupCommand()
39 command.execute() 39 command.execute()
40 40