Commit 13c0a17154679815c906ad4983d74a4a6793a487
1 parent
181a5482
Exists in
master
and in
39 other branches
Fixed flake8 validation for accounts
Showing
2 changed files
with
16 additions
and
14 deletions
Show diff stats
colab/accounts/search_indexes.py
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | 2 | ||
| 3 | from haystack import indexes | 3 | from haystack import indexes |
| 4 | -from django.db.models import Count | 4 | +# from django.db.models import Count |
| 5 | 5 | ||
| 6 | from colab.badger.utils import get_users_counters | 6 | from colab.badger.utils import get_users_counters |
| 7 | from .models import User | 7 | from .models import User |
| @@ -26,9 +26,9 @@ class UserIndex(indexes.SearchIndex, indexes.Indexable): | @@ -26,9 +26,9 @@ class UserIndex(indexes.SearchIndex, indexes.Indexable): | ||
| 26 | stored=False) | 26 | stored=False) |
| 27 | webpage = indexes.CharField(model_attr='webpage', null=True, stored=False) | 27 | webpage = indexes.CharField(model_attr='webpage', null=True, stored=False) |
| 28 | message_count = indexes.IntegerField(stored=False) | 28 | message_count = indexes.IntegerField(stored=False) |
| 29 | - #changeset_count = indexes.IntegerField(stored=False) | ||
| 30 | - #ticket_count = indexes.IntegerField(stored=False) | ||
| 31 | - #wiki_count = indexes.IntegerField(stored=False) | 29 | + # changeset_count = indexes.IntegerField(stored=False) |
| 30 | + # ticket_count = indexes.IntegerField(stored=False) | ||
| 31 | + # wiki_count = indexes.IntegerField(stored=False) | ||
| 32 | contribution_count = indexes.IntegerField(stored=False) | 32 | contribution_count = indexes.IntegerField(stored=False) |
| 33 | 33 | ||
| 34 | def get_model(self): | 34 | def get_model(self): |
| @@ -45,9 +45,9 @@ class UserIndex(indexes.SearchIndex, indexes.Indexable): | @@ -45,9 +45,9 @@ class UserIndex(indexes.SearchIndex, indexes.Indexable): | ||
| 45 | 45 | ||
| 46 | prepared_data['contribution_count'] = sum(( | 46 | prepared_data['contribution_count'] = sum(( |
| 47 | self.prepared_data['message_count'], | 47 | self.prepared_data['message_count'], |
| 48 | - # self.prepared_data['changeset_count'], | ||
| 49 | - # self.prepared_data['ticket_count'], | ||
| 50 | - # self.prepared_data['wiki_count'] | 48 | + # self.prepared_data['changeset_count'], |
| 49 | + # self.prepared_data['ticket_count'], | ||
| 50 | + # self.prepared_data['wiki_count'] | ||
| 51 | )) | 51 | )) |
| 52 | 52 | ||
| 53 | return prepared_data | 53 | return prepared_data |
| @@ -66,14 +66,14 @@ class UserIndex(indexes.SearchIndex, indexes.Indexable): | @@ -66,14 +66,14 @@ class UserIndex(indexes.SearchIndex, indexes.Indexable): | ||
| 66 | def prepare_message_count(self, obj): | 66 | def prepare_message_count(self, obj): |
| 67 | return self.badge_counters[obj.username]['messages'] | 67 | return self.badge_counters[obj.username]['messages'] |
| 68 | 68 | ||
| 69 | - #def prepare_changeset_count(self, obj): | ||
| 70 | - # return self.badge_counters[obj.username]['revisions'] | 69 | + # def prepare_changeset_count(self, obj): |
| 70 | + # return self.badge_counters[obj.username]['revisions'] | ||
| 71 | 71 | ||
| 72 | - #def prepare_ticket_count(self, obj): | ||
| 73 | - # return self.badge_counters[obj.username]['tickets'] | 72 | + # def prepare_ticket_count(self, obj): |
| 73 | + # return self.badge_counters[obj.username]['tickets'] | ||
| 74 | 74 | ||
| 75 | - #def prepare_wiki_count(self, obj): | ||
| 76 | - # return self.badge_counters[obj.username]['wikis'] | 75 | + # def prepare_wiki_count(self, obj): |
| 76 | + # return self.badge_counters[obj.username]['wikis'] | ||
| 77 | 77 | ||
| 78 | def index_queryset(self, using=None): | 78 | def index_queryset(self, using=None): |
| 79 | return self.get_model().objects.filter(is_active=True) | 79 | return self.get_model().objects.filter(is_active=True) |
colab/accounts/utils/validators.py
| @@ -11,8 +11,10 @@ def validate_social_account(account, url): | @@ -11,8 +11,10 @@ def validate_social_account(account, url): | ||
| 11 | >>> validate_social_account('seocam', 'http://twitter.com') | 11 | >>> validate_social_account('seocam', 'http://twitter.com') |
| 12 | True | 12 | True |
| 13 | 13 | ||
| 14 | - >>> validate_social_account('seocam-fake-should-fail', 'http://twitter.com') | 14 | + >>> validate_social_account('seocam-fake-should-fail', |
| 15 | + 'http://twitter.com') | ||
| 15 | False | 16 | False |
| 17 | + | ||
| 16 | """ | 18 | """ |
| 17 | 19 | ||
| 18 | request = urllib2.Request(urlparse.urljoin(url, account)) | 20 | request = urllib2.Request(urlparse.urljoin(url, account)) |