diff --git a/src/postorius/models.py b/src/postorius/models.py index 1ab0349..b3e388b 100644 --- a/src/postorius/models.py +++ b/src/postorius/models.py @@ -29,10 +29,7 @@ from django.http import Http404 from django_mailman3.lib.mailman import get_mailman_client from mailmanclient import MailmanConnectionError -try: - from urllib2 import HTTPError -except ImportError: - from urllib.error import HTTPError +from django.utils.six.moves.urllib.error import HTTPError logger = logging.getLogger(__name__) diff --git a/src/postorius/tests/mailman_api_tests/test_domain_index.py b/src/postorius/tests/mailman_api_tests/test_domain_index.py index 2b830bf..e76b8b3 100644 --- a/src/postorius/tests/mailman_api_tests/test_domain_index.py +++ b/src/postorius/tests/mailman_api_tests/test_domain_index.py @@ -21,10 +21,7 @@ from django.core.urlresolvers import reverse from django.contrib.auth.models import User from django_mailman3.models import MailDomain -try: - from urllib2 import HTTPError -except ImportError: - from urllib.error import HTTPError +from django.utils.six.moves.urllib.error import HTTPError from postorius.tests.utils import ViewTestCase diff --git a/src/postorius/tests/mailman_api_tests/test_models.py b/src/postorius/tests/mailman_api_tests/test_models.py index 79fa23f..32e2f53 100644 --- a/src/postorius/tests/mailman_api_tests/test_models.py +++ b/src/postorius/tests/mailman_api_tests/test_models.py @@ -19,10 +19,7 @@ from allauth.account.models import EmailAddress from django.contrib.auth.models import User -try: - from urllib2 import HTTPError -except ImportError: - from urllib.error import HTTPError +from django.utils.six.moves.urllib.error import HTTPError from postorius.tests.utils import ViewTestCase diff --git a/src/postorius/views/domain.py b/src/postorius/views/domain.py index 88f8b11..8e3dbf3 100644 --- a/src/postorius/views/domain.py +++ b/src/postorius/views/domain.py @@ -27,10 +27,7 @@ from django.shortcuts import render, redirect from django.utils.translation import gettext as _ from django_mailman3.models import MailDomain -try: - from urllib2 import HTTPError -except ImportError: - from urllib.error import HTTPError +from django.utils.six.moves.urllib.error import HTTPError from postorius import utils from postorius.auth.decorators import superuser_required from postorius.models import Domain, MailmanApiError, Mailman404Error diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index 2936ed2..3b2888e 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -35,10 +35,7 @@ from django.utils.translation import gettext as _ from django_mailman3.lib.mailman import get_mailman_client from django_mailman3.lib.paginator import paginate, MailmanPaginator -try: - from urllib2 import HTTPError -except ImportError: - from urllib.error import HTTPError +from django.utils.six.moves.urllib.error import HTTPError from postorius import utils from postorius.forms import ( diff --git a/src/postorius/views/user.py b/src/postorius/views/user.py index 50420db..a03f485 100644 --- a/src/postorius/views/user.py +++ b/src/postorius/views/user.py @@ -19,10 +19,7 @@ from __future__ import absolute_import, unicode_literals import logging -try: - from urllib2 import HTTPError -except ImportError: - from urllib.error import HTTPError +from django.utils.six.moves.urllib.error import HTTPError from allauth.account.models import EmailAddress from django.forms import formset_factory