Commit fd24ee4c990eaa036f67ead51ed4ef17eda4cfab

Authored by Rodrigo Siqueira de Melo
Committed by Sergio Oliveira
1 parent 080cb1eb

Fixed flake8

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
@@ -25,4 +25,3 @@ def ribbon(request): @@ -25,4 +25,3 @@ def ribbon(request):
25 'url': getattr(settings, 'RIBBON_URL', url), 25 'url': getattr(settings, 'RIBBON_URL', url),
26 } 26 }
27 } 27 }
28 -  
colab/plugins/mezuro/__init__.py
1 -default_app_config = 'colab.plugins.mezuro.apps.ProxyMezuroAppConfig'  
2 \ No newline at end of file 1 \ No newline at end of file
  2 +
  3 +
  4 +default_app_config = 'colab.plugins.mezuro.apps.ProxyMezuroAppConfig'
colab/plugins/mezuro/admin.py
1 -from django.contrib import admin 1 +# from django.contrib import admin
2 2
3 # Register your models here. 3 # Register your models here.
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
1 -from django.db import models 1 +# from django.db import models
2 2
3 # Create your models here. 3 # Create your models here.
colab/plugins/mezuro/tests.py
1 -from django.test import TestCase 1 +# from django.test import TestCase
2 2
3 # Create your tests here. 3 # Create your tests here.
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):