Skip to content
This repository
Browse code

adding fallback for django.core.mail.get_connection on Django 1.1.x (…

…introduced at 9e9a507)
  • Loading branch information...
commit 296cfba2b4a5225507eaa01a81095c3003eef716 1 parent 880f7d1
Michael Cetrulo authored June 09, 2010

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. 8  mailer/engine.py
8  mailer/engine.py
@@ -7,7 +7,13 @@
7 7
 
8 8
 from django.conf import settings
9 9
 from django.core.mail import send_mail as core_send_mail
10  
-from django.core.mail import get_connection
  10
+try:
  11
+    # Django 1.2
  12
+    from django.core.mail import get_connection
  13
+except ImportError:
  14
+    # ImportError: cannot import name get_connection
  15
+    from django.core.mail import SMTPConnection
  16
+    get_connection = lambda backend=None, fail_silently=False, **kwds: SMTPConnection(fail_silently=fail_silently)
11 17
 
12 18
 from mailer.models import Message, DontSendEntry, MessageLog
13 19
 

0 notes on commit 296cfba

Please sign in to comment.
Something went wrong with that request. Please try again.