diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-01-04 12:05:04 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-01-04 12:05:04 +0000 |
| commit | e07560a88e2bc1f5be2aabec25eca950259f7266 (patch) | |
| tree | 993698b699611434f8503d3fd4aea27fa645c5c1 /django/core | |
| parent | 89ded975fe1ff75b5b2456f4ee7e1256a261108e (diff) | |
Modified the way EMAIL_BACKEND is specified to make it consistent with the new "use the class name" policy for backends.
This is a BACKWARDS-INCOMPATIBLE CHANGE for anyone using a manually
specified EMAIL_BACKEND setting. If you have manually specified
EMAIL_BACKEND, you will need to append ".EmailBackend" to your
existing EMAIL_BACKEND setting. See the django-dev mailing list for
details.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12084 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core')
| -rw-r--r-- | django/core/mail/__init__.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/django/core/mail/__init__.py b/django/core/mail/__init__.py index 9a629035cf..f9d1210791 100644 --- a/django/core/mail/__init__.py +++ b/django/core/mail/__init__.py @@ -28,16 +28,17 @@ def get_connection(backend=None, fail_silently=False, **kwds): """ path = backend or settings.EMAIL_BACKEND try: - mod = import_module(path) + mod_name, klass_name = path.rsplit('.', 1) + mod = import_module(mod_name) except ImportError, e: - raise ImproperlyConfigured(('Error importing email backend %s: "%s"' - % (path, e))) + raise ImproperlyConfigured(('Error importing email backend module %s: "%s"' + % (mod_name, e))) try: - cls = getattr(mod, 'EmailBackend') + klass = getattr(mod, klass_name) except AttributeError: raise ImproperlyConfigured(('Module "%s" does not define a ' - '"EmailBackend" class' % path)) - return cls(fail_silently=fail_silently, **kwds) + '"%s" class' % (mod_name, klass_name))) + return klass(fail_silently=fail_silently, **kwds) def send_mail(subject, message, from_email, recipient_list, |
