Commit 0bf406ca55d5925dec05105b97f158ced6e24bf5
1 parent
5046caaf
Exists in
master
and in
27 other branches
Fix flake8
Signed-off-by: Alexandre Barbosa <alexandreab@live.com>
Showing
3 changed files
with
12 additions
and
9 deletions
Show diff stats
colab/accounts/utils/mailman.py
@@ -4,7 +4,6 @@ import requests | @@ -4,7 +4,6 @@ import requests | ||
4 | import logging | 4 | import logging |
5 | 5 | ||
6 | from django.conf import settings | 6 | from django.conf import settings |
7 | -from django.contrib import messages | ||
8 | 7 | ||
9 | TIMEOUT = 1 | 8 | TIMEOUT = 1 |
10 | 9 | ||
@@ -16,14 +15,17 @@ E = 'error' | @@ -16,14 +15,17 @@ E = 'error' | ||
16 | 15 | ||
17 | MAILMAN_MSGS = { | 16 | MAILMAN_MSGS = { |
18 | 0: (S, '%s: Success!'), | 17 | 0: (S, '%s: Success!'), |
19 | - 1: (S, '%s: An email confirmation was sent to you, please check your inbox.'), | ||
20 | - 2: (I, '%s: Your subscription was sent successfully! Please wait for the list\'s admin approval.'), | 18 | + 1: (S, '%s: An email confirmation was sent to you, please check your \ |
19 | +inbox.'), | ||
20 | + 2: (I, '%s: Your subscription was sent successfully! Please wait for the \ | ||
21 | +list\'s admin approval.'), | ||
21 | 3: (I, '%s: You are already a member of this list.'), | 22 | 3: (I, '%s: You are already a member of this list.'), |
22 | 4: (E, '%s: You are banned from this list!'), | 23 | 4: (E, '%s: You are banned from this list!'), |
23 | 5: (E, '%s: You appear to have an invalid email address.'), | 24 | 5: (E, '%s: You appear to have an invalid email address.'), |
24 | 6: (E, '%s: Your email address is considered to be hostile.'), | 25 | 6: (E, '%s: Your email address is considered to be hostile.'), |
25 | 7: (E, '%s: You are not a member of this list.'), | 26 | 7: (E, '%s: You are not a member of this list.'), |
26 | - 8: (E, 'Missing information: `email_from`, `subject` and `body` are mandatory.'), | 27 | + 8: (E, 'Missing information: `email_from`, `subject` and `body` are \ |
28 | +mandatory.'), | ||
27 | } | 29 | } |
28 | 30 | ||
29 | 31 | ||
@@ -48,7 +50,8 @@ def subscribe(listname, address): | @@ -48,7 +50,8 @@ def subscribe(listname, address): | ||
48 | def unsubscribe(listname, address): | 50 | def unsubscribe(listname, address): |
49 | url = get_url('subscribe/', listname) | 51 | url = get_url('subscribe/', listname) |
50 | try: | 52 | try: |
51 | - result = requests.delete(url, timeout=TIMEOUT, data={'address': address}) | 53 | + result = requests.delete(url, timeout=TIMEOUT, data={'address': |
54 | + address}) | ||
52 | msg_type, message = MAILMAN_MSGS[result.json()] | 55 | msg_type, message = MAILMAN_MSGS[result.json()] |
53 | return msg_type, message % listname | 56 | return msg_type, message % listname |
54 | except: | 57 | except: |
colab/accounts/views.py
@@ -149,7 +149,6 @@ class ManageUserSubscriptionsView(UserProfileBaseMixin, DetailView): | @@ -149,7 +149,6 @@ class ManageUserSubscriptionsView(UserProfileBaseMixin, DetailView): | ||
149 | show_message = getattr(messages, msg_type) | 149 | show_message = getattr(messages, msg_type) |
150 | show_message(request, _(message)) | 150 | show_message(request, _(message)) |
151 | 151 | ||
152 | - | ||
153 | return redirect('user_profile', username=user.username) | 152 | return redirect('user_profile', username=user.username) |
154 | 153 | ||
155 | def get_context_data(self, **kwargs): | 154 | def get_context_data(self, **kwargs): |
@@ -162,7 +161,8 @@ class ManageUserSubscriptionsView(UserProfileBaseMixin, DetailView): | @@ -162,7 +161,8 @@ class ManageUserSubscriptionsView(UserProfileBaseMixin, DetailView): | ||
162 | 161 | ||
163 | for email in emails: | 162 | for email in emails: |
164 | lists = [] | 163 | lists = [] |
165 | - lists_for_address = mailman.mailing_lists(address=email, names_only=True) | 164 | + lists_for_address = mailman.mailing_lists(address=email, |
165 | + names_only=True) | ||
166 | for mlist in all_lists: | 166 | for mlist in all_lists: |
167 | if mlist.get('listname') in lists_for_address: | 167 | if mlist.get('listname') in lists_for_address: |
168 | checked = True | 168 | checked = True |
@@ -170,7 +170,7 @@ class ManageUserSubscriptionsView(UserProfileBaseMixin, DetailView): | @@ -170,7 +170,7 @@ class ManageUserSubscriptionsView(UserProfileBaseMixin, DetailView): | ||
170 | checked = False | 170 | checked = False |
171 | lists.append(( | 171 | lists.append(( |
172 | {'listname': mlist.get('listname'), | 172 | {'listname': mlist.get('listname'), |
173 | - 'description': mlist.get('description')}, | 173 | + 'description': mlist.get('description')}, |
174 | checked | 174 | checked |
175 | )) | 175 | )) |
176 | 176 |
colab/plugins/gitlab/tests/test_gitlab.py
@@ -93,7 +93,7 @@ class GitlabTest(TestCase): | @@ -93,7 +93,7 @@ class GitlabTest(TestCase): | ||
93 | mr2.created_at = datetime.now() | 93 | mr2.created_at = datetime.now() |
94 | mr2.update_user(self.user.username) | 94 | mr2.update_user(self.user.username) |
95 | mr2.save() | 95 | mr2.save() |
96 | - | 96 | + |
97 | i1 = GitlabIssue() | 97 | i1 = GitlabIssue() |
98 | i1.id = 1 | 98 | i1.id = 1 |
99 | i1.iid = 1 | 99 | i1.iid = 1 |