From 4280f70504c7571b77d5fc66f722f4c37a6f2416 Mon Sep 17 00:00:00 2001 From: Gust Date: Thu, 26 Feb 2015 14:28:50 -0300 Subject: [PATCH] Fix flake8 warnings --- colab/accounts/utils/mailman.py | 2 +- colab/accounts/views.py | 3 +-- colab/home/views.py | 8 ++++---- colab/search/utils.py | 5 +++-- colab/super_archives/views.py | 3 +-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/colab/accounts/utils/mailman.py b/colab/accounts/utils/mailman.py index 213e4bf..e6728ba 100644 --- a/colab/accounts/utils/mailman.py +++ b/colab/accounts/utils/mailman.py @@ -115,4 +115,4 @@ def get_user_mailinglists(user): for email in emails: lists_for_user.extend(address_lists(email)) - return lists_for_user \ No newline at end of file + return lists_for_user diff --git a/colab/accounts/views.py b/colab/accounts/views.py index 3932c03..7304c90 100644 --- a/colab/accounts/views.py +++ b/colab/accounts/views.py @@ -15,7 +15,7 @@ from django.views.generic import DetailView, UpdateView, TemplateView from conversejs import xmpp from conversejs.models import XMPPAccount -from colab.super_archives.models import (EmailAddress, Message, +from colab.super_archives.models import (EmailAddress, EmailAddressValidation) from colab.search.utils import get_collaboration_data, get_visible_threads from colab.accounts.models import User @@ -80,7 +80,6 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView): context['type_count'] = count_types context['results'] = collaborations[:10] - email_pks = [addr.pk for addr in profile_user.emails.iterator()] query = get_visible_threads(logged_user, profile_user) query = query.order_by('-received_time') context['emails'] = query[:10] diff --git a/colab/home/views.py b/colab/home/views.py index 3a25f1e..757fd59 100644 --- a/colab/home/views.py +++ b/colab/home/views.py @@ -7,6 +7,7 @@ from colab.super_archives.models import Thread from colab.accounts.utils import mailinglist from colab.accounts.models import User + def dashboard(request): """Dashboard page""" @@ -23,19 +24,18 @@ def dashboard(request): for t in all_threads: if not t.mailinglist.is_private or \ - t.mailinglist.name in lists_for_user: - latest_threads.append(t) + t.mailinglist.name in lists_for_user: + latest_threads.append(t) hottest_threads = [] for t in highest_score_threads: if not t.mailinglist.is_private or \ - t.mailinglist.name in lists_for_user: + t.mailinglist.name in lists_for_user: hottest_threads.append(t.latest_message) latest_results, count_types = get_collaboration_data(user) latest_results.sort(key=lambda elem: elem.modified, reverse=True) - context = { 'hottest_threads': hottest_threads[:6], 'latest_threads': latest_threads[:6], diff --git a/colab/search/utils.py b/colab/search/utils.py index 2591dbb..24da40f 100644 --- a/colab/search/utils.py +++ b/colab/search/utils.py @@ -6,7 +6,6 @@ from collections import OrderedDict from django.core.cache import cache from django.utils.translation import ugettext as _ from django.conf import settings -from django.db.models.query import QuerySet from django.db.models import Q from colab.super_archives.models import Thread, Message @@ -26,6 +25,7 @@ def get_visible_threads_queryset(logged_user): return qs + def get_visible_threads(logged_user, filter_by_user=None): thread_qs = get_visible_threads_queryset(logged_user) if filter_by_user: @@ -38,9 +38,10 @@ def get_visible_threads(logged_user, filter_by_user=None): return messages + def get_collaboration_data(logged_user, filter_by_user=None): latest_results = [] - count_types = None#cache.get('home_chart') + count_types = cache.get('home_chart') populate_count_types = False if count_types is None: diff --git a/colab/super_archives/views.py b/colab/super_archives/views.py index 9595b6b..545d9fb 100644 --- a/colab/super_archives/views.py +++ b/colab/super_archives/views.py @@ -40,7 +40,7 @@ class ThreadView(View): user = User.objects.get(username=request.user) emails = user.emails.values_list('address', flat=True) lists_for_user = mailman.get_user_mailinglists(user) - if not thread.mailinglist.name in lists_for_user: + if thread.mailinglist.name not in lists_for_user: raise PermissionDenied thread.hit(request) @@ -141,7 +141,6 @@ class ThreadDashboardView(View): lists_for_user = [] if request.user.is_authenticated(): user = User.objects.get(username=request.user) - emails = user.emails.values_list('address', flat=True) lists_for_user = mailman.get_user_mailinglists(user) for list_ in MailingList.objects.order_by('name'): -- libgit2 0.21.2