Commit 9bdee49dd2207e6ef36b2c7d528291a970986d47
1 parent
b6548e0c
Exists in
gitlab_activity_view
Fixed flake8
Signed-off-by: Macartur Sousa <macartur.sc@gmail.com>
Showing
6 changed files
with
22 additions
and
26 deletions
Show diff stats
src/colab-spb-plugin/src/colab_spb/urls.py
... | ... | @@ -3,4 +3,5 @@ from . import views |
3 | 3 | |
4 | 4 | urlpatterns = patterns('', |
5 | 5 | url(r'^mail_list/$', views.mail_list, name='mail_list'), |
6 | - url(r'^gitlab_activity/$', views.gitlab_activity, name='gitlab_activity'),) | |
6 | + url(r'^gitlab_activity/$', views.gitlab_activity, | |
7 | + name='gitlab_activity'),) | ... | ... |
src/colab-spb-plugin/src/colab_spb/views.py
... | ... | @@ -9,7 +9,7 @@ from colab_spb.models import CommunityAssociations |
9 | 9 | |
10 | 10 | def mail_list(request): |
11 | 11 | community = request.GET.get('community', "") |
12 | - list_name = get_community_association(community).get("mailman_list","") | |
12 | + list_name = get_community_association(community).get("mailman_list", "") | |
13 | 13 | |
14 | 14 | MAX = request.GET.get('MAX', 7) |
15 | 15 | if not MAX or MAX < 0: |
... | ... | @@ -53,8 +53,8 @@ def mail_list(request): |
53 | 53 | |
54 | 54 | def gitlab_activity(request): |
55 | 55 | community = request.GET.get('community', "") |
56 | - limit = request.GET.get('limit',7) | |
57 | - offset = request.GET.get('offset',0) | |
56 | + limit = request.GET.get('limit', 7) | |
57 | + offset = request.GET.get('offset', 0) | |
58 | 58 | |
59 | 59 | context = {} |
60 | 60 | context['message'] = ("Esta comunidade não está associada a" |
... | ... | @@ -62,22 +62,21 @@ def gitlab_activity(request): |
62 | 62 | " detalhes contate o administrador.") |
63 | 63 | |
64 | 64 | association = get_community_association(community, limit, offset) |
65 | - context['community_association'] = association | |
65 | + context['community_association'] = association | |
66 | 66 | |
67 | 67 | return render(request, 'gitlab_activity.html', context) |
68 | 68 | |
69 | -def get_community_association(community,limit=7,offset=0): | |
69 | + | |
70 | +def get_community_association(community, limit=7, offset=0): | |
70 | 71 | if not community: |
71 | 72 | return {} |
72 | 73 | |
73 | 74 | associations = CommunityAssociations.objects.all() |
74 | 75 | for community_association in associations: |
75 | 76 | if community_association.community.name in community: |
76 | - return { 'community': community_association.community.name, | |
77 | - 'repository': community_association.group.url, | |
78 | - 'mailman_list': community_association.mail_list.name, | |
79 | - 'limit': limit, | |
80 | - 'offset': offset, | |
81 | - } | |
82 | - | |
77 | + return {'community': community_association.community.name, | |
78 | + 'repository': community_association.group.url, | |
79 | + 'mailman_list': community_association.mail_list.name, | |
80 | + 'limit': limit, | |
81 | + 'offset': offset} | |
83 | 82 | return {} | ... | ... |
src/colab-spb-plugin/tests/plugins.d/gitlab.py
src/colab-spb-plugin/tests/plugins.d/noosfero.py
src/colab-spb-plugin/tests/plugins.d/spb.py
1 | -from django.utils.translation import ugettext_lazy as _ | |
2 | -from colab.plugins.utils.menu import colab_url_factory | |
3 | - | |
1 | +from colab.plugins.utils.menu import colab_url_factory | |
2 | + | |
4 | 3 | name = "colab_spb" |
5 | 4 | verbose_name = "SPB Plugin" |
6 | 5 | |
7 | 6 | middlewares = ['colab_spb.middleware.ForceLangMiddleware'] |
8 | 7 | |
9 | -urls = { | |
10 | - "include":"colab_spb.urls", | |
11 | - "prefix": '^spb/', | |
12 | - "namespace":"colab_spb" | |
13 | - } | |
8 | +urls = {"include": "colab_spb.urls", | |
9 | + "prefix": '^spb/', | |
10 | + "namespace": "colab_spb"} | |
14 | 11 | |
15 | 12 | url = colab_url_factory('colab_spb') | ... | ... |
src/colab-spb-plugin/tests/test_colab_integration.py
... | ... | @@ -43,7 +43,7 @@ class SPBTest(TestCase): |
43 | 43 | " nenhum repositório no momento, para mais" |
44 | 44 | " detalhes contate o administrador.") |
45 | 45 | self.assertIn(message, response.content) |
46 | - self.assertEqual(dict() ,response.context['community_association']) | |
46 | + self.assertEqual(dict(), response.context['community_association']) | |
47 | 47 | self.assertEqual(200, response.status_code) |
48 | 48 | |
49 | 49 | def test_gitlab_community_association_with_valid_community(self): |
... | ... | @@ -70,7 +70,6 @@ class SPBTest(TestCase): |
70 | 70 | self.assertEqual(type(result), dict) |
71 | 71 | self.assertEqual(result['limit'], "5") |
72 | 72 | |
73 | - | |
74 | 73 | def test_gitlab_community_association_with_no_default_offset(self): |
75 | 74 | response = self.client.get("/spb/gitlab_activity/" |
76 | 75 | "?community=example_community" |
... | ... | @@ -78,4 +77,4 @@ class SPBTest(TestCase): |
78 | 77 | |
79 | 78 | result = response.context['community_association'] |
80 | 79 | |
81 | - self.assertEqual(result['offset'],"5") | |
80 | + self.assertEqual(result['offset'], "5") | ... | ... |