Author: mtredinnick
Date: 2008-10-24 01:15:54 -0500 (Fri, 24 Oct 2008)
New Revision: 9253

Modified:
   django/branches/releases/1.0.X/AUTHORS
   django/branches/releases/1.0.X/django/core/mail.py
   django/branches/releases/1.0.X/tests/regressiontests/mail/tests.py
Log:
[1.0.X] Backed out r9250. I committed this to the branch by mistake; there's no
bug in functionality fixed by this. Refs #9383.


Modified: django/branches/releases/1.0.X/AUTHORS
===================================================================
--- django/branches/releases/1.0.X/AUTHORS      2008-10-24 06:11:37 UTC (rev 
9252)
+++ django/branches/releases/1.0.X/AUTHORS      2008-10-24 06:15:54 UTC (rev 
9253)
@@ -422,7 +422,6 @@
     Jason Yan <[EMAIL PROTECTED]>
     [EMAIL PROTECTED]
     [EMAIL PROTECTED]
-    Jesse Young <[EMAIL PROTECTED]>
     Jarek Zgoda <[EMAIL PROTECTED]>
     Cheng Zhang
 

Modified: django/branches/releases/1.0.X/django/core/mail.py
===================================================================
--- django/branches/releases/1.0.X/django/core/mail.py  2008-10-24 06:11:37 UTC 
(rev 9252)
+++ django/branches/releases/1.0.X/django/core/mail.py  2008-10-24 06:15:54 UTC 
(rev 9253)
@@ -268,10 +268,6 @@
 
     def send(self, fail_silently=False):
         """Sends the email message."""
-        if not self.recipients():
-            # Don't bother creating the network connection if there's nobody to
-            # send to.
-            return 0
         return self.get_connection(fail_silently).send_messages([self])
 
     def attach(self, filename=None, content=None, mimetype=None):
@@ -370,16 +366,12 @@
 
 def mail_admins(subject, message, fail_silently=False):
     """Sends a message to the admins, as defined by the ADMINS setting."""
-    if not settings.ADMINS:
-        return
     EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message,
                  settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS]
                  ).send(fail_silently=fail_silently)
 
 def mail_managers(subject, message, fail_silently=False):
     """Sends a message to the managers, as defined by the MANAGERS setting."""
-    if not settings.MANAGERS:
-        return
     EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message,
                  settings.SERVER_EMAIL, [a[1] for a in settings.MANAGERS]
                  ).send(fail_silently=fail_silently)

Modified: django/branches/releases/1.0.X/tests/regressiontests/mail/tests.py
===================================================================
--- django/branches/releases/1.0.X/tests/regressiontests/mail/tests.py  
2008-10-24 06:11:37 UTC (rev 9252)
+++ django/branches/releases/1.0.X/tests/regressiontests/mail/tests.py  
2008-10-24 06:15:54 UTC (rev 9253)
@@ -2,9 +2,7 @@
 r"""
 # Tests for the django.core.mail.
 
->>> from django.conf import settings
->>> from django.core import mail
->>> from django.core.mail import EmailMessage, mail_admins, mail_managers
+>>> from django.core.mail import EmailMessage
 >>> from django.utils.translation import ugettext_lazy
 
 # Test normal ascii character case:
@@ -62,30 +60,4 @@
 >>> email.message().as_string()
 'Content-Type: text/plain; charset="utf-8"\nMIME-Version: 
1.0\nContent-Transfer-Encoding: quoted-printable\nSubject: subject\nFrom: 
[EMAIL PROTECTED]: [EMAIL PROTECTED]: Fri, 09 Nov 2001 01:08:47 
-0000\nMessage-ID: foo\n\ncontent'
 
-# Test that mail_admins/mail_managers doesn't connect to the mail server if 
there are no recipients (#9383)
-
->>> old_admins = settings.ADMINS
->>> old_managers = settings.MANAGERS
->>> settings.ADMINS = []
->>> settings.MANAGERS = []
->>> mail.outbox = []
->>> mail_admins('hi','there')
->>> len(mail.outbox)
-0
->>> mail.outbox = []
->>> mail_managers('hi','there')
->>> len(mail.outbox)
-0
->>> settings.ADMINS = settings.MANAGERS = [('nobody','[EMAIL PROTECTED]')]
->>> mail.outbox = []
->>> mail_admins('hi','there')
->>> len(mail.outbox)
-1
->>> mail.outbox = []
->>> mail_managers('hi','there')
->>> len(mail.outbox)
-1
->>> settings.ADMINS = old_admins
->>> settings.MANAGERS = old_managers
-
 """


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to