annotate gpp/core/tasks.py @ 513:9e7ae8462f3f

Using celery to send mail out of the request/response cycle.
author Brian Neal <bgneal@gmail.com>
date Tue, 13 Dec 2011 02:07:55 +0000
parents
children beda97542da8
rev   line source
bgneal@513 1 """
bgneal@513 2 Celery tasks for the core application.
bgneal@513 3
bgneal@513 4 """
bgneal@513 5 from celery.task import task
bgneal@513 6 import django.core.mail
bgneal@513 7
bgneal@513 8
bgneal@513 9 @task
bgneal@513 10 def add(x, y):
bgneal@513 11 return x + y
bgneal@513 12
bgneal@513 13 @task
bgneal@513 14 def send_mail(subject, message, from_email, recipient_list, **kwargs):
bgneal@513 15 django.core.mail.send_mail(subject, message, from_email, recipient_list,
bgneal@513 16 **kwargs)