Permalink
Browse files

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

…introduced at 9e9a507)
  • Loading branch information...
1 parent 880f7d1 commit 296cfba2b4a5225507eaa01a81095c3003eef716 @git2samus git2samus committed Jun 9, 2010
Showing with 7 additions and 1 deletion.
  1. +7 −1 mailer/engine.py
View
8 mailer/engine.py
@@ -7,7 +7,13 @@
from django.conf import settings
from django.core.mail import send_mail as core_send_mail
-from django.core.mail import get_connection
+try:
+ # Django 1.2
+ from django.core.mail import get_connection
+except ImportError:
+ # ImportError: cannot import name get_connection
+ from django.core.mail import SMTPConnection
+ get_connection = lambda backend=None, fail_silently=False, **kwds: SMTPConnection(fail_silently=fail_silently)
from mailer.models import Message, DontSendEntry, MessageLog

0 comments on commit 296cfba

Please sign in to comment.