Added implicit connections for smtp #17471. #792

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants
@ezequielsz

Credits to dje as this is just an update for his patch.

Ticket: https://code.djangoproject.com/ticket/17471

Added implicit connections for smtp #17471.
Credits to dje as this is just an update for his patch.
+ if use_ssl is None:
+ self.use_ssl = settings.EMAIL_USE_SSL
+ else:
+ self.use_ssl = use_ssl
self.connection = None

This comment has been minimized.

@charettes

charettes Feb 26, 2013

Member

Maybe we could raise a ValueError if self.use_ssl and self.use_tls? The message should also make reference to EMAIL_USE_SSL and EMAIL_USE_TLS since we default to them when use_(ssl|tsl) are None.

@charettes

charettes Feb 26, 2013

Member

Maybe we could raise a ValueError if self.use_ssl and self.use_tls? The message should also make reference to EMAIL_USE_SSL and EMAIL_USE_TLS since we default to them when use_(ssl|tsl) are None.

+
+.. setting:: EMAIL_USE_SSL
+
+EMAIL_USE_SSL

This comment has been minimized.

@charettes

charettes Feb 26, 2013

Member

This will need a versionadded clause.

@charettes

charettes Feb 26, 2013

Member

This will need a versionadded clause.

+ try:
+ backend.open()
+ self.fail('SMTPException STARTTLS not raised.')
+ except SMTPException, e:

This comment has been minimized.

@charettes

charettes Feb 26, 2013

Member

This will fail on PY3 because of the comma syntax. Can this be replaced by a assertRaisesMessage?

@charettes

charettes Feb 26, 2013

Member

This will fail on PY3 because of the comma syntax. Can this be replaced by a assertRaisesMessage?

+ backend.open()
+ self.fail('SSLError not raised.')
+ except SSLError, e:
+ pass

This comment has been minimized.

@charettes

charettes Feb 26, 2013

Member

This whole try/except logic can be replaced by a self.assertRaises(SSLError, backend.open).

@charettes

charettes Feb 26, 2013

Member

This whole try/except logic can be replaced by a self.assertRaises(SSLError, backend.open).

@@ -21,6 +21,10 @@
from django.utils.six import PY3, StringIO
from django.utils.translation import ugettext_lazy
+from smtplib import SMTPException
+from ssl import SSLError
+

This comment has been minimized.

@areski

This comment has been minimized.

Show comment
Hide comment
@areski

areski May 18, 2013

Contributor

during djangocon eu I tried to correct this ticket :
please find a new pull request : #1124

Contributor

areski commented May 18, 2013

during djangocon eu I tried to correct this ticket :
please find a new pull request : #1124

@timgraham timgraham closed this May 31, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment