diff --git a/src/postorius/management/commands/mmclient.py b/src/postorius/management/commands/mmclient.py index 5bf48a5..564c037 100644 --- a/src/postorius/management/commands/mmclient.py +++ b/src/postorius/management/commands/mmclient.py @@ -36,7 +36,6 @@ def handle(self, *args, **options): # choose an interpreter - console = None try: import IPython console_fn = IPython.embed 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 aef4b65..4ab3771 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_members.py +++ b/src/postorius/tests/mailman_api_tests/test_list_members.py @@ -175,7 +175,6 @@ url = reverse('list_members', args=('foo@example.com', 'moderator',)) response = self.client.post(url, {'email': 'newmod@example.com'}) self.assertRedirects(response, url) - moderators = self.foo_list.moderators def tearDown(self): self.foo_list.delete() 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..10129cc 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_summary.py +++ b/src/postorius/tests/mailman_api_tests/test_list_summary.py @@ -92,7 +92,7 @@ def test_list_summary_owner(self): # Response must contain the administration menu - user = self.mm_client.create_user('test@example.com', None) + self.mm_client.create_user('test@example.com', None) mlist = self.mm_client.get_list('foo@example.com') mlist.add_owner('test@example.com') self.client.login(username='testuser', password='testpass') @@ -102,7 +102,7 @@ def test_list_summary_moderator(self): # Response must contain the administration menu - user = self.mm_client.create_user('test@example.com', None) + self.mm_client.create_user('test@example.com', None) mlist = self.mm_client.get_list('foo@example.com') mlist.add_moderator('test@example.com') self.client.login(username='testuser', password='testpass') @@ -156,8 +156,10 @@ self.assertContains(response, 'List metrics') def test_list_metrics_displayed_to_superuser(self): - mlist = self.mm_client.get_list('foo@example.com') - User.objects.create_superuser('testadminuser', 'testadmin@example.com', 'testpass') - self.assertTrue(self.client.login(username='testadminuser', password='testpass')) - response = self.client.get(reverse('list_summary', args=('foo@example.com',))) + User.objects.create_superuser('testadminuser', 'testadmin@example.com', + 'testpass') + self.assertTrue(self.client.login(username='testadminuser', + password='testpass')) + response = self.client.get(reverse('list_summary', + args=('foo@example.com',))) self.assertContains(response, 'List metrics') diff --git a/src/postorius/tests/mailman_api_tests/test_subscriptions.py b/src/postorius/tests/mailman_api_tests/test_subscriptions.py index b0098bb..ad3def3 100644 --- a/src/postorius/tests/mailman_api_tests/test_subscriptions.py +++ b/src/postorius/tests/mailman_api_tests/test_subscriptions.py @@ -60,6 +60,7 @@ self.mod_list.delete() self.mm_user.delete() self.domain.delete() + User.objects.all().delete() def test_subscribe_open(self): # The subscription goes straight through. @@ -138,8 +139,7 @@ # Subscribe the user (they are now allowed to self-subscribe) self.mod_list.subscribe('test@example.com') # Login as the owner to accept the subscription - owner = User.objects.create_user( - 'testowner', 'owner@example.com', 'pwd') + User.objects.create_user('testowner', 'owner@example.com', 'pwd') self.mod_list.add_owner('owner@example.com') self.client.logout() self.client.login(username='testowner', password='pwd') diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index 3345ff8..0ddcb51 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -211,11 +211,10 @@ form = ListSubscribe(user_emails, request.POST) for address in user_emails: try: - userMember = self.mailing_list.get_member(address) + self.mailing_list.get_member(address) except ValueError: pass else: - userSubscribed = True old_email = address break # no need to test more addresses if form.is_valid(): @@ -374,7 +373,7 @@ messages.success(request, _('The selected messages were discarded')) except MailmanApiError: return utils.render_api_error(request) - except HTTPError as e: + except HTTPError: messages.error(request, _('Message could not be found')) else: form = MultipleChoiceForm() @@ -806,7 +805,6 @@ except ValueError as e: messages.error(request, _('Invalid data: %s') % e) return redirect('list_bans', list_id) - addban_form = ListAddBanForm() else: addban_form = ListAddBanForm() return render(request, 'postorius/lists/bans.html', { diff --git a/src/postorius/views/user.py b/src/postorius/views/user.py index 7ce0f68..314bd07 100644 --- a/src/postorius/views/user.py +++ b/src/postorius/views/user.py @@ -232,7 +232,7 @@ @login_required() -def user_profile(request, user_email=None): +def user_profile(request): utils.set_other_emails(request.user) try: mm_user = MailmanUser.objects.get_or_create_from_django(request.user)