Skip to content
This repository has been archived by the owner on Jan 31, 2018. It is now read-only.

Commit

Permalink
[bug 1015788] Cosmetic: flake8 fixes (feedback)
Browse files Browse the repository at this point in the history
  • Loading branch information
willkg committed Aug 12, 2014
1 parent afdfc6a commit 05e0a33
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
1 change: 1 addition & 0 deletions fjord/feedback/api_views.py
Expand Up @@ -102,6 +102,7 @@ def get_throttles(self):
methods=('GET',))
]


class PostFeedbackAPI(rest_framework.generics.CreateAPIView):
serializer_class = models.PostResponseSerializer

Expand Down
6 changes: 2 additions & 4 deletions fjord/feedback/forms.py
@@ -1,7 +1,5 @@
from django import forms

from tower import ugettext as _


class URLInput(forms.TextInput):
"""Text field with HTML5 URL Input type."""
Expand All @@ -27,6 +25,6 @@ class ResponseForm(forms.Form):
# These are hidden fields on the form which we have here so we can
# abuse the fields for data validation.
manufacturer = forms.CharField(required=False, widget=forms.HiddenInput(
attrs={'class': 'manufacturer'}))
attrs={'class': 'manufacturer'}))
device = forms.CharField(required=False, widget=forms.HiddenInput(
attrs={'class': 'device'}))
attrs={'class': 'device'}))
17 changes: 11 additions & 6 deletions fjord/feedback/models.py
Expand Up @@ -366,7 +366,6 @@ def public_fields(cls):
'created'
)


@classmethod
def get_mapping(cls):
return {
Expand Down Expand Up @@ -491,10 +490,15 @@ def morelikethis(cls, resp):
else:
min_term_freq = 1

return MLT(id_=resp.id, s = s, mlt_fields=['description'],
index=cls.get_index(), doctype=cls.get_mapping_type_name(),
stop_words=list(ANALYSIS_STOPWORDS),
min_term_freq=min_term_freq)
return MLT(
id_=resp.id,
s=s,
mlt_fields=['description'],
index=cls.get_index(),
doctype=cls.get_mapping_type_name(),
stop_words=list(ANALYSIS_STOPWORDS),
min_term_freq=min_term_freq
)


class ResponseEmail(ModelBase):
Expand Down Expand Up @@ -541,7 +545,8 @@ class PostResponseSerializer(serializers.Serializer):
url = serializers.URLField(required=False, default=u'')
description = serializers.CharField(required=True)

category = serializers.CharField(max_length=50, required=False, default=u'')
category = serializers.CharField(max_length=50, required=False,
default=u'')

# product, channel, version, locale, platform
product = NoNullsCharField(max_length=20, required=True)
Expand Down
6 changes: 0 additions & 6 deletions fjord/feedback/utils.py
@@ -1,13 +1,7 @@
from hashlib import md5
import re
import urlparse

from elasticsearch.exceptions import ElasticsearchException

from django.utils.encoding import force_str

from fjord.feedback import config
from fjord.search.index import es_analyze


TOKEN_SPLIT_RE = re.compile(r'[\s\.\,\/\\\?\;\:\"\*\&\^\%\$\#\@\!]+')
Expand Down
5 changes: 2 additions & 3 deletions fjord/feedback/views.py
Expand Up @@ -338,7 +338,7 @@ def android_about_feedback(request, locale=None):
@csrf_exempt
@never_cache
def feedback_router_dev(request, product=None, version=None, channel=None,
*args, **kwargs):
*args, **kwargs):
"""DEV ONLY FEEDBACK ROUTER"""
view = None

Expand Down Expand Up @@ -392,7 +392,7 @@ def feedback_router_dev(request, product=None, version=None, channel=None,
})

view = view or generic_feedback_dev

return view(request, request.locale, product, version, channel,
*args, **kwargs)

Expand Down Expand Up @@ -443,7 +443,6 @@ def feedback_router(request, product=None, version=None, channel=None,

return android_about_feedback(request, request.locale)


# FIXME - validate these better
version = smart_str(version)
channel = smart_str(channel).lower()
Expand Down

0 comments on commit 05e0a33

Please sign in to comment.