diff --git a/setup.py b/setup.py
index 878c56a..2b26979 100644
--- a/setup.py
+++ b/setup.py
@@ -15,12 +15,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Postorius. If not, see .
-try:
- import setuptools
-except ImportError:
- import ez_setup
- ez_setup.use_setuptools()
-
from setuptools import setup, find_packages
diff --git a/src/postorius/auth/decorators.py b/src/postorius/auth/decorators.py
index 53d2ad1..2791825 100644
--- a/src/postorius/auth/decorators.py
+++ b/src/postorius/auth/decorators.py
@@ -18,13 +18,10 @@
"""Postorius view decorators."""
-from django.contrib.auth import logout, authenticate, login
+from django.contrib.auth import authenticate, login
from django.core.exceptions import PermissionDenied
-from postorius.models import (Domain, List, Member, MailmanUser,
- MailmanApiError, Mailman404Error)
-
-from .utils import set_user_access_props
+from postorius.auth.utils import set_user_access_props
def basic_auth_login(fn):
diff --git a/src/postorius/fieldset_forms.py b/src/postorius/fieldset_forms.py
index 01550b4..2b23f3a 100644
--- a/src/postorius/fieldset_forms.py
+++ b/src/postorius/fieldset_forms.py
@@ -19,7 +19,6 @@
from django.forms import Form
from django.utils import safestring
from django.forms.forms import BoundField
-from django.forms.utils import ErrorList
class FieldsetError(Exception):
diff --git a/src/postorius/forms.py b/src/postorius/forms.py
index 4eaf396..805eb0e 100644
--- a/src/postorius/forms.py
+++ b/src/postorius/forms.py
@@ -23,7 +23,6 @@
from django.contrib.auth.models import User
from postorius.fieldset_forms import FieldsetForm
-from postorius.models import AddressConfirmationProfile
from postorius import utils
try:
diff --git a/src/postorius/management/commands/mmclient.py b/src/postorius/management/commands/mmclient.py
index d92104b..5ac3e7f 100644
--- a/src/postorius/management/commands/mmclient.py
+++ b/src/postorius/management/commands/mmclient.py
@@ -16,10 +16,8 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
-from django.conf import settings
-from django.core.management.base import BaseCommand, CommandError
+from django.core.management.base import BaseCommand
from postorius import utils
-from urllib2 import HTTPError
class Command(BaseCommand):
help = """Opens a Python shell with a mailmanclient object named `client`.
diff --git a/src/postorius/models.py b/src/postorius/models.py
index 1c6d6d0..5d7f690 100644
--- a/src/postorius/models.py
+++ b/src/postorius/models.py
@@ -19,7 +19,6 @@
absolute_import, division, print_function, unicode_literals)
-import random
import uuid
import logging
@@ -33,7 +32,6 @@
from django.dispatch import receiver
from django.db import models
from django.http import Http404
-from django.template import Context
from django.template.loader import render_to_string
from mailmanclient import MailmanConnectionError
from postorius.utils import get_client
diff --git a/src/postorius/templatetags/bootstrap_tags.py b/src/postorius/templatetags/bootstrap_tags.py
index 827fb16..da04dbc 100644
--- a/src/postorius/templatetags/bootstrap_tags.py
+++ b/src/postorius/templatetags/bootstrap_tags.py
@@ -16,7 +16,6 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
-from django.core.urlresolvers import reverse
from django import template
diff --git a/src/postorius/templatetags/nav_helpers.py b/src/postorius/templatetags/nav_helpers.py
index d2b5733..211d014 100644
--- a/src/postorius/templatetags/nav_helpers.py
+++ b/src/postorius/templatetags/nav_helpers.py
@@ -16,7 +16,6 @@
# You should have received a copy of the GNU General Public License along with
# Postorius. If not, see .
-from django.core.urlresolvers import reverse
from django import template
diff --git a/src/postorius/templatetags/pagination.py b/src/postorius/templatetags/pagination.py
index cc67b4f..f73fb7f 100644
--- a/src/postorius/templatetags/pagination.py
+++ b/src/postorius/templatetags/pagination.py
@@ -17,7 +17,6 @@
# Postorius. If not, see .
from django import template
-from django.core.urlresolvers import reverse
from django.utils.html import conditional_escape
diff --git a/src/postorius/tests/mailman_api_tests/test_domain_new.py b/src/postorius/tests/mailman_api_tests/test_domain_new.py
index c4925bc..af5a020 100644
--- a/src/postorius/tests/mailman_api_tests/test_domain_new.py
+++ b/src/postorius/tests/mailman_api_tests/test_domain_new.py
@@ -17,11 +17,8 @@
from __future__ import absolute_import, print_function, unicode_literals
-import time
-
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
-from django.shortcuts import resolve_url
try:
from urllib2 import HTTPError
diff --git a/src/postorius/tests/mailman_api_tests/test_list_bans.py b/src/postorius/tests/mailman_api_tests/test_list_bans.py
index 2ae37ea..a51f99c 100644
--- a/src/postorius/tests/mailman_api_tests/test_list_bans.py
+++ b/src/postorius/tests/mailman_api_tests/test_list_bans.py
@@ -19,14 +19,8 @@
from __future__ import absolute_import, print_function, unicode_literals
-import mock
-
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
-try:
- from urllib2 import HTTPError
-except ImportError:
- from urllib.error import HTTPError
from postorius.tests.utils import ViewTestCase
diff --git a/src/postorius/tests/mailman_api_tests/test_list_header_matches.py b/src/postorius/tests/mailman_api_tests/test_list_header_matches.py
index 1e2975e..bf9dc47 100644
--- a/src/postorius/tests/mailman_api_tests/test_list_header_matches.py
+++ b/src/postorius/tests/mailman_api_tests/test_list_header_matches.py
@@ -21,11 +21,7 @@
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
-from django.utils.timezone import now
-from six.moves.urllib_error import HTTPError
-from six.moves.urllib_parse import quote
-from postorius.models import MailmanUser, Mailman404Error, List
from postorius.tests.utils import ViewTestCase
diff --git a/src/postorius/tests/mailman_api_tests/test_list_index.py b/src/postorius/tests/mailman_api_tests/test_list_index.py
index 3aba901..90de59b 100644
--- a/src/postorius/tests/mailman_api_tests/test_list_index.py
+++ b/src/postorius/tests/mailman_api_tests/test_list_index.py
@@ -18,10 +18,6 @@
from __future__ import absolute_import, print_function, unicode_literals
from django.core.urlresolvers import reverse
-try:
- from urllib2 import HTTPError
-except ImportError:
- from urllib.error import HTTPError
from postorius.tests.utils import ViewTestCase
diff --git a/src/postorius/tests/mailman_api_tests/test_list_members.py b/src/postorius/tests/mailman_api_tests/test_list_members.py
index 4e45d8a..3707121 100644
--- a/src/postorius/tests/mailman_api_tests/test_list_members.py
+++ b/src/postorius/tests/mailman_api_tests/test_list_members.py
@@ -19,11 +19,7 @@
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
-from django.utils.timezone import now
-from six.moves.urllib_error import HTTPError
-from six.moves.urllib_parse import quote
-from postorius.models import MailmanUser, Mailman404Error
from postorius.tests.utils import ViewTestCase
diff --git a/src/postorius/tests/mailman_api_tests/test_list_new.py b/src/postorius/tests/mailman_api_tests/test_list_new.py
index 27a7a95..2b1522e 100644
--- a/src/postorius/tests/mailman_api_tests/test_list_new.py
+++ b/src/postorius/tests/mailman_api_tests/test_list_new.py
@@ -17,16 +17,8 @@
from __future__ import absolute_import, print_function, unicode_literals
-import time
-
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
-from django.shortcuts import resolve_url
-
-try:
- from urllib2 import HTTPError
-except ImportError:
- from urllib.error import HTTPError
from postorius.tests.utils import ViewTestCase
diff --git a/src/postorius/tests/mailman_api_tests/test_list_settings.py b/src/postorius/tests/mailman_api_tests/test_list_settings.py
index c6204ff..12318b3 100644
--- a/src/postorius/tests/mailman_api_tests/test_list_settings.py
+++ b/src/postorius/tests/mailman_api_tests/test_list_settings.py
@@ -21,12 +21,9 @@
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
-from django.utils.timezone import now
-from six.moves.urllib_error import HTTPError
-from six.moves.urllib_parse import quote
from postorius.views.list import SETTINGS_FORMS
-from postorius.models import MailmanUser, Mailman404Error, List
+from postorius.models import List
from postorius.tests.utils import ViewTestCase
diff --git a/src/postorius/tests/mailman_api_tests/test_list_summary.py b/src/postorius/tests/mailman_api_tests/test_list_summary.py
index 27eb61c..c2f46d0 100644
--- a/src/postorius/tests/mailman_api_tests/test_list_summary.py
+++ b/src/postorius/tests/mailman_api_tests/test_list_summary.py
@@ -19,11 +19,6 @@
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
-from django.db import IntegrityError
-try:
- from urllib2 import HTTPError
-except ImportError:
- from 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 8db2931..ccd4ba5 100644
--- a/src/postorius/tests/mailman_api_tests/test_models.py
+++ b/src/postorius/tests/mailman_api_tests/test_models.py
@@ -18,8 +18,6 @@
from __future__ import absolute_import, print_function, unicode_literals
from django.contrib.auth.models import User
-from django.core.urlresolvers import reverse
-from django.db import IntegrityError
try:
from urllib2 import HTTPError
except ImportError:
diff --git a/src/postorius/tests/mailman_api_tests/test_profile.py b/src/postorius/tests/mailman_api_tests/test_profile.py
index 6a760ce..b561863 100644
--- a/src/postorius/tests/mailman_api_tests/test_profile.py
+++ b/src/postorius/tests/mailman_api_tests/test_profile.py
@@ -21,10 +21,6 @@
from django.contrib.auth.models import User
from mock import patch
from smtplib import SMTPException
-try:
- from urllib2 import HTTPError
-except ImportError:
- from urllib.error import HTTPError
from postorius.models import AddressConfirmationProfile
from postorius.tests.utils import ViewTestCase
diff --git a/src/postorius/tests/mailman_api_tests/test_subscriptions.py b/src/postorius/tests/mailman_api_tests/test_subscriptions.py
index b0098bb..d975e0e 100644
--- a/src/postorius/tests/mailman_api_tests/test_subscriptions.py
+++ b/src/postorius/tests/mailman_api_tests/test_subscriptions.py
@@ -19,10 +19,6 @@
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
-try:
- from urllib2 import HTTPError
-except ImportError:
- from urllib.error import HTTPError
from postorius.tests.utils import ViewTestCase
diff --git a/src/postorius/tests/mailman_api_tests/test_user.py b/src/postorius/tests/mailman_api_tests/test_user.py
index ddc73cb..b3d01ab 100644
--- a/src/postorius/tests/mailman_api_tests/test_user.py
+++ b/src/postorius/tests/mailman_api_tests/test_user.py
@@ -21,7 +21,6 @@
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from mock import patch
-from six.moves.urllib_parse import quote
from postorius.models import MailmanUser, Mailman404Error
from postorius.tests.utils import ViewTestCase
diff --git a/src/postorius/tests/test_auth_decorators.py b/src/postorius/tests/test_auth_decorators.py
index f0c0c88..a697d09 100644
--- a/src/postorius/tests/test_auth_decorators.py
+++ b/src/postorius/tests/test_auth_decorators.py
@@ -22,10 +22,7 @@
from mock import patch
from postorius.auth.decorators import (list_owner_required,
- list_moderator_required,
- basic_auth_login)
-from postorius.models import (Domain, List, Member, MailmanUser,
- MailmanApiError, Mailman404Error)
+ list_moderator_required)
from mailmanclient import Client
@@ -43,7 +40,6 @@
"""Tests the list_owner_required auth decorator."""
def setUp(self):
- from django.test.client import RequestFactory
from postorius.tests.utils import create_mock_list
self.request_factory = RequestFactory()
# create a mock list with members
@@ -109,7 +105,6 @@
"""Tests the list_owner_required auth decorator."""
def setUp(self):
- from django.test.client import RequestFactory
from postorius.tests.utils import create_mock_list
self.request_factory = RequestFactory()
# create a mock list with members
diff --git a/src/postorius/tests/utils.py b/src/postorius/tests/utils.py
index fa3bc2e..1b3675f 100644
--- a/src/postorius/tests/utils.py
+++ b/src/postorius/tests/utils.py
@@ -17,12 +17,11 @@
import logging
-from django import VERSION as DJANGO_VERSION
from django.conf import settings
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.test import RequestFactory, TestCase
-from mock import patch, MagicMock
+from mock import MagicMock
from six.moves.urllib_parse import quote
from postorius.utils import get_client
diff --git a/src/postorius/utils.py b/src/postorius/utils.py
index 53a641a..8eb0998 100644
--- a/src/postorius/utils.py
+++ b/src/postorius/utils.py
@@ -20,7 +20,6 @@
from django.conf import settings
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.shortcuts import render
-from django.template import RequestContext
from mailmanclient import Client
from django.utils.translation import gettext as _
diff --git a/src/postorius/views/domain.py b/src/postorius/views/domain.py
index 7dfd7ec..39f7e55 100644
--- a/src/postorius/views/domain.py
+++ b/src/postorius/views/domain.py
@@ -21,13 +21,13 @@
from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.urlresolvers import reverse
from django.shortcuts import render, redirect
-from django.template import RequestContext
from django.utils.translation import gettext as _
try:
from urllib2 import HTTPError
except ImportError:
from urllib.error import HTTPError
from postorius import utils
+from postorius.models import Domain
from postorius.forms import *
from postorius.auth.decorators import *
diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py
index a5aa49e..87e9b3a 100644
--- a/src/postorius/views/list.py
+++ b/src/postorius/views/list.py
@@ -39,6 +39,7 @@
from postorius import utils
from postorius.forms import *
+from postorius.models import Domain, List, MailmanApiError
from postorius.auth.decorators import *
from postorius.views.generic import MailingListView
diff --git a/src/postorius/views/user.py b/src/postorius/views/user.py
index 7ce0f68..85568e9 100644
--- a/src/postorius/views/user.py
+++ b/src/postorius/views/user.py
@@ -21,13 +21,10 @@
from django.forms.formsets import formset_factory
from django.contrib import messages
-from django.contrib.auth.decorators import (login_required,user_passes_test)
-from django.core.urlresolvers import reverse
+from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect, render
-from django.template import RequestContext
from django.utils.decorators import method_decorator
from django.utils.translation import gettext as _
-from django.views.generic import TemplateView
from django.http import Http404
try:
@@ -36,7 +33,8 @@
from urllib.error import HTTPError
from postorius import utils
-from postorius.models import MailmanConnectionError, AddressConfirmationProfile
+from postorius.models import (MailmanConnectionError, MailmanApiError, List,
+ AddressConfirmationProfile, MailmanUser)
from postorius.forms import *
from postorius.auth.decorators import *
from postorius.views.generic import MailmanUserView
@@ -44,7 +42,6 @@
from socket import error as socket_error
import errno
import uuid
-import datetime
logger = logging.getLogger(__name__)
@@ -258,7 +255,7 @@
else:
form = AddressActivationForm(initial={'user_email': request.user.email})
return render(request, 'postorius/user/profile.html',
- {'mm_user': mm_user, 'form': form}, context_instance=RequestContext(request))
+ {'mm_user': mm_user, 'form': form})