From 0bf406ca55d5925dec05105b97f158ced6e24bf5 Mon Sep 17 00:00:00 2001 From: Alexandre Barbosa Date: Thu, 27 Aug 2015 17:27:18 -0300 Subject: [PATCH] Fix flake8 --- colab/accounts/utils/mailman.py | 13 ++++++++----- colab/accounts/views.py | 6 +++--- colab/plugins/gitlab/tests/test_gitlab.py | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/colab/accounts/utils/mailman.py b/colab/accounts/utils/mailman.py index 74d3a3a..1e36578 100644 --- a/colab/accounts/utils/mailman.py +++ b/colab/accounts/utils/mailman.py @@ -4,7 +4,6 @@ import requests import logging from django.conf import settings -from django.contrib import messages TIMEOUT = 1 @@ -16,14 +15,17 @@ E = 'error' MAILMAN_MSGS = { 0: (S, '%s: Success!'), - 1: (S, '%s: An email confirmation was sent to you, please check your inbox.'), - 2: (I, '%s: Your subscription was sent successfully! Please wait for the list\'s admin approval.'), + 1: (S, '%s: An email confirmation was sent to you, please check your \ +inbox.'), + 2: (I, '%s: Your subscription was sent successfully! Please wait for the \ +list\'s admin approval.'), 3: (I, '%s: You are already a member of this list.'), 4: (E, '%s: You are banned from this list!'), 5: (E, '%s: You appear to have an invalid email address.'), 6: (E, '%s: Your email address is considered to be hostile.'), 7: (E, '%s: You are not a member of this list.'), - 8: (E, 'Missing information: `email_from`, `subject` and `body` are mandatory.'), + 8: (E, 'Missing information: `email_from`, `subject` and `body` are \ +mandatory.'), } @@ -48,7 +50,8 @@ def subscribe(listname, address): def unsubscribe(listname, address): url = get_url('subscribe/', listname) try: - result = requests.delete(url, timeout=TIMEOUT, data={'address': address}) + result = requests.delete(url, timeout=TIMEOUT, data={'address': + address}) msg_type, message = MAILMAN_MSGS[result.json()] return msg_type, message % listname except: diff --git a/colab/accounts/views.py b/colab/accounts/views.py index 666e611..5b206e8 100644 --- a/colab/accounts/views.py +++ b/colab/accounts/views.py @@ -149,7 +149,6 @@ class ManageUserSubscriptionsView(UserProfileBaseMixin, DetailView): show_message = getattr(messages, msg_type) show_message(request, _(message)) - return redirect('user_profile', username=user.username) def get_context_data(self, **kwargs): @@ -162,7 +161,8 @@ class ManageUserSubscriptionsView(UserProfileBaseMixin, DetailView): for email in emails: lists = [] - lists_for_address = mailman.mailing_lists(address=email, names_only=True) + lists_for_address = mailman.mailing_lists(address=email, + names_only=True) for mlist in all_lists: if mlist.get('listname') in lists_for_address: checked = True @@ -170,7 +170,7 @@ class ManageUserSubscriptionsView(UserProfileBaseMixin, DetailView): checked = False lists.append(( {'listname': mlist.get('listname'), - 'description': mlist.get('description')}, + 'description': mlist.get('description')}, checked )) diff --git a/colab/plugins/gitlab/tests/test_gitlab.py b/colab/plugins/gitlab/tests/test_gitlab.py index 188a21d..1206365 100644 --- a/colab/plugins/gitlab/tests/test_gitlab.py +++ b/colab/plugins/gitlab/tests/test_gitlab.py @@ -93,7 +93,7 @@ class GitlabTest(TestCase): mr2.created_at = datetime.now() mr2.update_user(self.user.username) mr2.save() - + i1 = GitlabIssue() i1.id = 1 i1.iid = 1 -- libgit2 0.21.2