Gregory Haskins avatar Gregory Haskins committed d38d507

Added setting specifying task queue to use for sending mail (EMAIL_QUEUE_NAME)

Comments (0)

Files changed (2)

 
     def _defer_message(self, message):
         from google.appengine.ext import deferred
-        deferred.defer(_send_deferred, message, fail_silently=self.fail_silently)
+        from django.conf import settings
+        queue_name = getattr(settings, 'EMAIL_QUEUE_NAME', 'default')
+        deferred.defer(_send_deferred, 
+                       message, 
+                       fail_silently=self.fail_silently,
+                       _queue=queue_name)
 
 class AsyncEmailBackend(EmailBackend):
     can_defer = True
 else:
     EMAIL_BACKEND = 'djangoappengine.mail.EmailBackend'
 
+# Specify a queue name for the async. email backend
+EMAIL_QUEUE_NAME = 'default'
+
 PREPARE_UPLOAD_BACKEND = 'djangoappengine.storage.prepare_upload'
 SERVE_FILE_BACKEND = 'djangoappengine.storage.serve_file'
 DEFAULT_FILE_STORAGE = 'djangoappengine.storage.BlobstoreStorage'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.