diff gpp/core/functions.py @ 252:e3958aacd8dd

Adding a way to expedite mail by bypassing the mail queue.
author Brian Neal <bgneal@gmail.com>
date Mon, 20 Sep 2010 00:40:01 +0000
parents 27bee3ac85e6
children 767cedc7d12a
line wrap: on
line diff
--- a/gpp/core/functions.py	Sun Sep 19 23:55:48 2010 +0000
+++ b/gpp/core/functions.py	Mon Sep 20 00:40:01 2010 +0000
@@ -9,14 +9,15 @@
 import mailer
 
 
-def send_mail(subject, message, from_email, recipient_list, 
-        fail_silently = False, auth_user = None, auth_password = None):
+def send_mail(subject, message, from_email, recipient_list,
+        fail_silently=False, auth_user=None, auth_password=None,
+        expedite=False):
     """The main gpp send email function.
     Use this function to send email from the site. It will obey debug settings and
-    log all emails.
+    log all emails. The expedite flag, when True, will bypass the mail queue.
     """
 
-    if settings.MAILER_ENQUEUE_MAIL:
+    if settings.MAILER_ENQUEUE_MAIL and not expedite:
         mailer.enqueue_mail(subject, message, from_email, recipient_list)
     elif settings.GPP_SEND_EMAIL:
         django.core.mail.send_mail(subject, message, from_email, recipient_list,