Commit 4280f70504c7571b77d5fc66f722f4c37a6f2416
Committed by
Sergio Oliveira
1 parent
0e5123ab
Exists in
master
and in
39 other branches
Fix flake8 warnings
Signed-off-by: Gustavo Jaruga <darksshades@gmail.com> Signed-off-by: Alexandre Barbosa <alexandreab@live.com>
Showing
5 changed files
with
10 additions
and
11 deletions
Show diff stats
colab/accounts/utils/mailman.py
colab/accounts/views.py
... | ... | @@ -15,7 +15,7 @@ from django.views.generic import DetailView, UpdateView, TemplateView |
15 | 15 | from conversejs import xmpp |
16 | 16 | from conversejs.models import XMPPAccount |
17 | 17 | |
18 | -from colab.super_archives.models import (EmailAddress, Message, | |
18 | +from colab.super_archives.models import (EmailAddress, | |
19 | 19 | EmailAddressValidation) |
20 | 20 | from colab.search.utils import get_collaboration_data, get_visible_threads |
21 | 21 | from colab.accounts.models import User |
... | ... | @@ -80,7 +80,6 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView): |
80 | 80 | context['type_count'] = count_types |
81 | 81 | context['results'] = collaborations[:10] |
82 | 82 | |
83 | - email_pks = [addr.pk for addr in profile_user.emails.iterator()] | |
84 | 83 | query = get_visible_threads(logged_user, profile_user) |
85 | 84 | query = query.order_by('-received_time') |
86 | 85 | context['emails'] = query[:10] | ... | ... |
colab/home/views.py
... | ... | @@ -7,6 +7,7 @@ from colab.super_archives.models import Thread |
7 | 7 | from colab.accounts.utils import mailinglist |
8 | 8 | from colab.accounts.models import User |
9 | 9 | |
10 | + | |
10 | 11 | def dashboard(request): |
11 | 12 | """Dashboard page""" |
12 | 13 | |
... | ... | @@ -23,19 +24,18 @@ def dashboard(request): |
23 | 24 | |
24 | 25 | for t in all_threads: |
25 | 26 | if not t.mailinglist.is_private or \ |
26 | - t.mailinglist.name in lists_for_user: | |
27 | - latest_threads.append(t) | |
27 | + t.mailinglist.name in lists_for_user: | |
28 | + latest_threads.append(t) | |
28 | 29 | |
29 | 30 | hottest_threads = [] |
30 | 31 | for t in highest_score_threads: |
31 | 32 | if not t.mailinglist.is_private or \ |
32 | - t.mailinglist.name in lists_for_user: | |
33 | + t.mailinglist.name in lists_for_user: | |
33 | 34 | hottest_threads.append(t.latest_message) |
34 | 35 | |
35 | 36 | latest_results, count_types = get_collaboration_data(user) |
36 | 37 | latest_results.sort(key=lambda elem: elem.modified, reverse=True) |
37 | 38 | |
38 | - | |
39 | 39 | context = { |
40 | 40 | 'hottest_threads': hottest_threads[:6], |
41 | 41 | 'latest_threads': latest_threads[:6], | ... | ... |
colab/search/utils.py
... | ... | @@ -6,7 +6,6 @@ from collections import OrderedDict |
6 | 6 | from django.core.cache import cache |
7 | 7 | from django.utils.translation import ugettext as _ |
8 | 8 | from django.conf import settings |
9 | -from django.db.models.query import QuerySet | |
10 | 9 | from django.db.models import Q |
11 | 10 | |
12 | 11 | from colab.super_archives.models import Thread, Message |
... | ... | @@ -26,6 +25,7 @@ def get_visible_threads_queryset(logged_user): |
26 | 25 | |
27 | 26 | return qs |
28 | 27 | |
28 | + | |
29 | 29 | def get_visible_threads(logged_user, filter_by_user=None): |
30 | 30 | thread_qs = get_visible_threads_queryset(logged_user) |
31 | 31 | if filter_by_user: |
... | ... | @@ -38,9 +38,10 @@ def get_visible_threads(logged_user, filter_by_user=None): |
38 | 38 | |
39 | 39 | return messages |
40 | 40 | |
41 | + | |
41 | 42 | def get_collaboration_data(logged_user, filter_by_user=None): |
42 | 43 | latest_results = [] |
43 | - count_types = None#cache.get('home_chart') | |
44 | + count_types = cache.get('home_chart') | |
44 | 45 | populate_count_types = False |
45 | 46 | |
46 | 47 | if count_types is None: | ... | ... |
colab/super_archives/views.py
... | ... | @@ -40,7 +40,7 @@ class ThreadView(View): |
40 | 40 | user = User.objects.get(username=request.user) |
41 | 41 | emails = user.emails.values_list('address', flat=True) |
42 | 42 | lists_for_user = mailman.get_user_mailinglists(user) |
43 | - if not thread.mailinglist.name in lists_for_user: | |
43 | + if thread.mailinglist.name not in lists_for_user: | |
44 | 44 | raise PermissionDenied |
45 | 45 | |
46 | 46 | thread.hit(request) |
... | ... | @@ -141,7 +141,6 @@ class ThreadDashboardView(View): |
141 | 141 | lists_for_user = [] |
142 | 142 | if request.user.is_authenticated(): |
143 | 143 | user = User.objects.get(username=request.user) |
144 | - emails = user.emails.values_list('address', flat=True) | |
145 | 144 | lists_for_user = mailman.get_user_mailinglists(user) |
146 | 145 | |
147 | 146 | for list_ in MailingList.objects.order_by('name'): | ... | ... |