Replaced deprecated sslerror by ssl.SSLError

The exact conditions on which this exception is raised are not
known, but this replacement is the best guess we can do at this
point.
This commit is contained in:
Claude Paroz 2013-01-03 22:12:11 +01:00
parent 6248833d9e
commit 850630b4b7
1 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
"""SMTP email backend class.""" """SMTP email backend class."""
import smtplib import smtplib
import socket import ssl
import threading import threading
from django.conf import settings from django.conf import settings
@ -65,7 +65,7 @@ class EmailBackend(BaseEmailBackend):
try: try:
try: try:
self.connection.quit() self.connection.quit()
except (socket.sslerror, smtplib.SMTPServerDisconnected): except (ssl.SSLError, smtplib.SMTPServerDisconnected):
# This happens when calling quit() on a TLS connection # This happens when calling quit() on a TLS connection
# sometimes, or when the connection was already disconnected # sometimes, or when the connection was already disconnected
# by the server. # by the server.