Skip to content

Commit

Permalink
Catch general socket errors for mail submission.
Browse files Browse the repository at this point in the history
An addition to 57620b6 to get tests to run with no connection to the outside world.

Also see #92.
  • Loading branch information
dokterbob committed Oct 3, 2013
1 parent 6950fa6 commit f6ef035
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions newsletter/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

logger = logging.getLogger(__name__)


import datetime
import socket

from socket import gaierror
from smtplib import SMTPException

from django.core.exceptions import ValidationError, ImproperlyConfigured
Expand Down Expand Up @@ -415,7 +414,7 @@ def form_valid(self, form):
try:
self.subscription.send_activation_email(action=self.action)

except (SMTPException, gaierror), e:
except (SMTPException, socket.error), e:
logger.exception(
'Error %s while submitting email to %s.',
e, self.subscription.email
Expand Down

0 comments on commit f6ef035

Please sign in to comment.