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 8b3435c..f4919a2 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 564c037..5e7c685 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): 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 09c114e..a09e545 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 7439002..ef90ec8 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 197c01e..749ffbd 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 4ab3771..22e2d01 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 03287a5..2ba1073 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 798cf77..63525f4 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 10129cc..3234a50 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 e67d7c2..6abe87e 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 ad3def3..d2780a7 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 7a210c7..35e56ba 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 55bb0f3..1551cc9 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/urls.py b/src/postorius/urls.py index ef58024..429a2b9 100644 --- a/src/postorius/urls.py +++ b/src/postorius/urls.py @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License along with # Postorius. If not, see . -from django.conf.urls import * +from django.conf.urls import url, include from django.contrib.auth.views import login as login_view from django.contrib.auth.views import logout as logout_view diff --git a/src/postorius/utils.py b/src/postorius/utils.py index 00571a0..a9711fb 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..5a14e56 100644 --- a/src/postorius/views/domain.py +++ b/src/postorius/views/domain.py @@ -21,15 +21,14 @@ 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.forms import * -from postorius.auth.decorators import * +from postorius.models import Domain +from postorius.forms import DomainNew @login_required diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index 0ddcb51..21a6a98 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -38,8 +38,16 @@ from urllib.error import HTTPError from postorius import utils -from postorius.forms import * -from postorius.auth.decorators import * +from postorius.forms import ( + ListNew, MemberForm, ListSubscribe, MultipleChoiceForm, + ListSubscriptionPolicyForm, ArchiveSettingsForm, + MessageAcceptanceForm, DigestSettingsForm, AlterMessagesForm, + ListAutomaticResponsesForm, ListIdentityForm, + ListMassSubscription, ListMassRemoval, ListAddBanForm, + ListHeaderMatchForm, ListHeaderMatchFormset, MemberModeration) +from postorius.models import Domain, List, MailmanApiError +from postorius.auth.decorators import (list_owner_required, + list_moderator_required) from postorius.views.generic import MailingListView diff --git a/src/postorius/views/user.py b/src/postorius/views/user.py index 314bd07..c9dedf6 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,15 +33,14 @@ from urllib.error import HTTPError from postorius import utils -from postorius.models import MailmanConnectionError, AddressConfirmationProfile -from postorius.forms import * -from postorius.auth.decorators import * +from postorius.models import (MailmanConnectionError, MailmanApiError, List, + AddressConfirmationProfile, MailmanUser) +from postorius.forms import UserPreferences, AddressActivationForm from postorius.views.generic import MailmanUserView from smtplib import SMTPException from socket import error as socket_error import errno import uuid -import datetime logger = logging.getLogger(__name__) @@ -258,7 +254,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})