catch "Network is unreachable" error

This commit is contained in:
Thomas Waldmann 2014-05-28 15:19:21 +02:00
parent 1821229e83
commit 3d922e4f13

View File

@ -3,6 +3,7 @@
views for the interactive web user interface views for the interactive web user interface
""" """
import socket
from datetime import timedelta from datetime import timedelta
from django.db.models import Q from django.db.models import Q
@ -203,6 +204,8 @@ class OverviewView(CreateView):
except Domain.DoesNotExist: except Domain.DoesNotExist:
# should not happen: POST data had invalid (base)domain # should not happen: POST data had invalid (base)domain
success, level, msg = False, messages.ERROR, 'Base domain does not exist.' success, level, msg = False, messages.ERROR, 'Base domain does not exist.'
except socket.error as err:
success, level, msg = False, messages.ERROR, 'Communication to name server failed [%s]' % str(err)
else: else:
self.object.created_by = self.request.user self.object.created_by = self.request.user
self.object.save() self.object.save()