Commit fd24ee4c990eaa036f67ead51ed4ef17eda4cfab
Committed by
Sergio Oliveira
1 parent
080cb1eb
Exists in
master
and in
31 other branches
Fixed flake8
Showing
10 changed files
with
22 additions
and
18 deletions
Show diff stats
colab/accounts/views.py
1 | # encoding: utf-8 | 1 | # encoding: utf-8 |
2 | from collections import OrderedDict | 2 | from collections import OrderedDict |
3 | 3 | ||
4 | -from django.conf import settings | ||
5 | from django.contrib import messages | 4 | from django.contrib import messages |
6 | -from django.db import transaction | ||
7 | from django.db.models import Count | 5 | from django.db.models import Count |
8 | from django.contrib.auth import get_user_model | 6 | from django.contrib.auth import get_user_model |
9 | from django.utils.translation import ugettext as _ | 7 | from django.utils.translation import ugettext as _ |
10 | -from django.shortcuts import render, redirect, get_object_or_404 | 8 | +from django.shortcuts import render, redirect |
11 | from django.core.urlresolvers import reverse | 9 | from django.core.urlresolvers import reverse |
12 | from django.core.exceptions import PermissionDenied | 10 | from django.core.exceptions import PermissionDenied |
13 | -from django.views.generic import DetailView, UpdateView, TemplateView | 11 | +from django.views.generic import DetailView, UpdateView |
14 | from django.http import Http404 | 12 | from django.http import Http404 |
15 | 13 | ||
16 | from colab.super_archives.models import (EmailAddress, | 14 | from colab.super_archives.models import (EmailAddress, |
@@ -18,8 +16,7 @@ from colab.super_archives.models import (EmailAddress, | @@ -18,8 +16,7 @@ from colab.super_archives.models import (EmailAddress, | ||
18 | from colab.search.utils import get_collaboration_data, get_visible_threads | 16 | from colab.search.utils import get_collaboration_data, get_visible_threads |
19 | from colab.accounts.models import User | 17 | from colab.accounts.models import User |
20 | 18 | ||
21 | -from .forms import (UserCreationForm, UserForm, ListsForm, | ||
22 | - UserUpdateForm) | 19 | +from .forms import (UserCreationForm, ListsForm, UserUpdateForm) |
23 | from .utils import mailman | 20 | from .utils import mailman |
24 | 21 | ||
25 | 22 |
colab/home/context_processors.py
colab/plugins/mezuro/__init__.py
colab/plugins/mezuro/admin.py
colab/plugins/mezuro/apps.py
1 | -from django.utils.translation import ugettext_lazy as _ | 1 | +# from django.utils.translation import ugettext_lazy as _ |
2 | from ..utils.apps import ColabProxiedAppConfig | 2 | from ..utils.apps import ColabProxiedAppConfig |
3 | 3 | ||
4 | + | ||
4 | class ProxyMezuroAppConfig(ColabProxiedAppConfig): | 5 | class ProxyMezuroAppConfig(ColabProxiedAppConfig): |
5 | name = 'colab.plugins.mezuro' | 6 | name = 'colab.plugins.mezuro' |
6 | verbose_name = 'Mezuro Proxy' | 7 | verbose_name = 'Mezuro Proxy' |
colab/plugins/mezuro/models.py
colab/plugins/mezuro/tests.py
colab/plugins/mezuro/views.py
1 | from ..utils.views import ColabProxyView | 1 | from ..utils.views import ColabProxyView |
2 | 2 | ||
3 | + | ||
3 | class MezuroProxyView(ColabProxyView): | 4 | class MezuroProxyView(ColabProxyView): |
4 | app_label = 'mezuro' | 5 | app_label = 'mezuro' |
5 | diazo_theme_template = 'proxy/mezuro.html' | 6 | diazo_theme_template = 'proxy/mezuro.html' |
colab/search/forms.py
@@ -107,10 +107,11 @@ class ColabSearchForm(SearchForm): | @@ -107,10 +107,11 @@ class ColabSearchForm(SearchForm): | ||
107 | # http://wiki.apache.org/solr/FunctionQuery#Date_Boosting | 107 | # http://wiki.apache.org/solr/FunctionQuery#Date_Boosting |
108 | 'bf': 'recip(ms(NOW/HOUR,modified),3.16e-11,1,1)^10', | 108 | 'bf': 'recip(ms(NOW/HOUR,modified),3.16e-11,1,1)^10', |
109 | } | 109 | } |
110 | + hayString = 'haystack.backends.whoosh_backend.WhooshEngine' | ||
111 | + if settings.HAYSTACK_CONNECTIONS['default']['ENGINE'] != hayString: | ||
112 | + sqs = sqs.filter(content=AltParser( | ||
113 | + 'edismax', q, **dismax_opts)) | ||
110 | 114 | ||
111 | - if settings.HAYSTACK_CONNECTIONS['default']['ENGINE'] != \ | ||
112 | - 'haystack.backends.whoosh_backend.WhooshEngine': | ||
113 | - sqs = sqs.filter(content=AltParser('edismax', q, **dismax_opts)) | ||
114 | else: | 115 | else: |
115 | sqs = sqs.filter(content=AutoQuery(q)) | 116 | sqs = sqs.filter(content=AutoQuery(q)) |
116 | 117 |
colab/search/tests.py
@@ -21,11 +21,14 @@ class SearchViewTest(TestCase): | @@ -21,11 +21,14 @@ class SearchViewTest(TestCase): | ||
21 | 21 | ||
22 | self.assertEqual(3, len(thread_list)) | 22 | self.assertEqual(3, len(thread_list)) |
23 | 23 | ||
24 | - condition = any('This is a repply to Thread 1 on list A' in t.description for t in thread_list) | 24 | + condition = any('This is a repply to Thread 1 on list A' in |
25 | + t.description for t in thread_list) | ||
25 | self.assertTrue(condition) | 26 | self.assertTrue(condition) |
26 | - condition = any('This is a repply to Thread 1 on list B' in t.description for t in thread_list) | 27 | + condition = any('This is a repply to Thread 1 on list B' in |
28 | + t.description for t in thread_list) | ||
27 | self.assertTrue(condition) | 29 | self.assertTrue(condition) |
28 | - condition = any('This is a repply to Thread 1 on list C' in t.description for t in thread_list) | 30 | + condition = any('This is a repply to Thread 1 on list C' in |
31 | + t.description for t in thread_list) | ||
29 | self.assertTrue(condition) | 32 | self.assertTrue(condition) |
30 | 33 | ||
31 | def test_search_account_by_firstName(self): | 34 | def test_search_account_by_firstName(self): |