Commits

Paul McLanahan committed 92b4371

Add entry in changelog. Bump version number.

Also changed kwarg key to be a bit more obscure
and likely unique, and changed dict.get to get.pop
to clean up the kwargs if something else uses them
in the future.

  • Participants
  • Parent commits 1c696b5
  • Tags 1.0.3

Comments (0)

Files changed (5)

 Changelog
 =========
 
+1.0.3 - 2012.03.06
+------------------
+
+* Backend will now pass any kwargs with which it is initialized to the
+  email sending backend.
+* Thanks to `Fedor Tyurin`_ for the contribution.
+
+.. _`Fedor Tyurin`: https://bitbucket.org/ftyurin
+
+
 1.0.2 - 2012.02.21
 ------------------
 

File djcelery_email/__init__.py

 """Django email backend for celery."""
 
-VERSION = (1, 0, 2)
+VERSION = (1, 0, 3)
 
 __version__ = '.'.join(map(str, VERSION))
 __author__ = 'Paul McLanahan'

File djcelery_email/backends.py

 
     def send_messages(self, email_messages, **kwargs):
         results = []
-        kwargs['backend_kwargs'] = self.init_kwargs
+        kwargs['_backend_init_kwargs'] = self.init_kwargs
         for msg in email_messages:
             results.append(send_email.delay(msg, **kwargs))
         return results

File djcelery_email/tasks.py

 @task(**TASK_CONFIG)
 def send_email(message, **kwargs):
     logger = send_email.get_logger()
-    conn = get_connection(backend=BACKEND, **kwargs.get('backend_kwargs', {}))
+    conn = get_connection(backend=BACKEND,
+                          **kwargs.pop('_backend_init_kwargs', {}))
     try:
         result = conn.send_messages([message])
         logger.debug("Successfully sent email message to %r.", message.to)

File test_project/tester/tests.py

 from djcelery_email.tasks import send_email
 import djcelery_email
 
+
 class TestBackend(mail.backends.base.BaseEmailBackend):
     def __init__(self, username=None, password=None, fail_silently=False, **kwargs):
         self.username = username
     def send_messages(self, email_messages):
         return {'username': self.username, 'password': self.password}
 
+
 class DjangoCeleryEmailTests(TestCase):
 
     def test_sending_email(self):
         self.assertEqual(len(results), 2)
         self.assertEqual(mail.outbox[0].subject, 'mass 1')
         self.assertEqual(mail.outbox[1].subject, 'mass 2')
-    
+
     def test_setting_extra_configs(self):
         self.assertEqual(send_email.queue, 'django_email')
         self.assertEqual(send_email.delivery_mode, 1)