Commit 4fa89b81 authored by jc's avatar jc

fixes E302 expected 2 blank lines, found 1

parent 0caa3e89
...@@ -11,7 +11,7 @@ from captcha.fields import CaptchaField ...@@ -11,7 +11,7 @@ from captcha.fields import CaptchaField
class AdvancedEditor(forms.Textarea): class AdvancedEditor(forms.Textarea):
class Media: class Media:
js = (settings.MEDIA_URL + '/js/tinymce/tiny_mce.js',) js = (settings.MEDIA_URL + '/js/tinymce/tiny_mce.js', )
def __init__(self, language=None, attrs=None): def __init__(self, language=None, attrs=None):
self.language = language or settings.LANGUAGE_CODE[:2] self.language = language or settings.LANGUAGE_CODE[:2]
...@@ -23,10 +23,10 @@ class AdvancedEditor(forms.Textarea): ...@@ -23,10 +23,10 @@ class AdvancedEditor(forms.Textarea):
class AddViolation(forms.Form): class AddViolation(forms.Form):
resource_name = forms.CharField(required=True, max_length=4096, label=_('Please describe the discrimination'), help_text=_("What service or site, or person is unavailable or seems artificially slowed down. e.g. VoIP, p2p, filesharing, specific websites, etc.")) resource_name = forms.CharField(required=True, max_length=4096, label=_('Please describe the discrimination'), help_text=_("What service or site, or person is unavailable or seems artificially slowed down. e.g. VoIP, p2p, filesharing, specific websites, etc."))
country = forms.ChoiceField(required=True, choices=(('',''),)+tuple(sorted(COUNTRIES,key=itemgetter(1))), label=_("Country"), help_text=_('EU member state where the discrimination is reported.')) country = forms.ChoiceField(required=True, choices=(('', ''), ) + tuple(sorted(COUNTRIES, key=itemgetter(1))), label=_("Country"), help_text=_('EU member state where the discrimination is reported.'))
operator = forms.CharField(required=True, max_length=256, label=_("Operator"), help_text=_('The ISP or operator providing the Internet service.')) operator = forms.CharField(required=True, max_length=256, label=_("Operator"), help_text=_('The ISP or operator providing the Internet service.'))
contract = forms.CharField(required=True, max_length=256, label=_("Contract"), help_text=_('The specific contract at the ISP provider. (please be as specific as possible)')) contract = forms.CharField(required=True, max_length=256, label=_("Contract"), help_text=_('The specific contract at the ISP provider. (please be as specific as possible)'))
media = forms.ChoiceField(required=True, choices=tuple(sorted(MEDIA,key=itemgetter(1))), label=_('Is the Internet connection over mobile or fixed line?')) media = forms.ChoiceField(required=True, choices=tuple(sorted(MEDIA, key=itemgetter(1))), label=_('Is the Internet connection over mobile or fixed line?'))
comment = forms.CharField(required=True, widget=AdvancedEditor(), label=_('Please describe the symptoms you are experiencing.')) comment = forms.CharField(required=True, widget=AdvancedEditor(), label=_('Please describe the symptoms you are experiencing.'))
email = forms.EmailField(required=True, label=_('Email (set this to enable saving)'), help_text=_("We need your email to validate your report. Your email address is obligatory, but we will never use your personal data for anything else than checking the submission. (see next for an optional exception)")) email = forms.EmailField(required=True, label=_('Email (set this to enable saving)'), help_text=_("We need your email to validate your report. Your email address is obligatory, but we will never use your personal data for anything else than checking the submission. (see next for an optional exception)"))
consent = forms.BooleanField(required=False, label=_("I want to help further"), help_text=_("We need your consent to contact you for clarifications regarding your report. This is optional, but helps us improve the quality of the reports. Thanks!")) consent = forms.BooleanField(required=False, label=_("I want to help further"), help_text=_("We need your consent to contact you for clarifications regarding your report. This is optional, but helps us improve the quality of the reports. Thanks!"))
...@@ -40,11 +40,12 @@ class AddViolation(forms.Form): ...@@ -40,11 +40,12 @@ class AddViolation(forms.Form):
type = forms.ChoiceField(required=True, choices=tuple(TYPES), label=_('How would you describe the discrimination?')) type = forms.ChoiceField(required=True, choices=tuple(TYPES), label=_('How would you describe the discrimination?'))
captcha = CaptchaField(label=_("In order to protect against spam, please fill in the result of the following calculation. (note the + and the * are somewhat confusing)")) captcha = CaptchaField(label=_("In order to protect against spam, please fill in the result of the following calculation. (note the + and the * are somewhat confusing)"))
class SearchViolation(SearchForm): class SearchViolation(SearchForm):
country = forms.ChoiceField(required=False, choices=(('',''),)+tuple(sorted(COUNTRIES,key=itemgetter(1))), label=_("Country"), help_text=_('EU member state where the discrimination is reported.')) country = forms.ChoiceField(required=False, choices=(('', ''),) + tuple(sorted(COUNTRIES, key=itemgetter(1))), label=_("Country"), help_text=_('EU member state where the discrimination is reported.'))
operator = forms.CharField(required=False, max_length=256, label=_("Operator"), help_text=_('The ISP or operator providing the Internet service.')) operator = forms.CharField(required=False, max_length=256, label=_("Operator"), help_text=_('The ISP or operator providing the Internet service.'))
contract = forms.CharField(required=False, max_length=256, label=_("Contract"), help_text=_('The specific contract at the ISP provider. (please be as specific as possible)')) contract = forms.CharField(required=False, max_length=256, label=_("Contract"), help_text=_('The specific contract at the ISP provider. (please be as specific as possible)'))
media = forms.ChoiceField(required=False, choices=(('',''),)+tuple(sorted(MEDIA,key=itemgetter(1))), label=_('Is the Internet connection over mobile or fixed line?')) media = forms.ChoiceField(required=False, choices=(('', ''), ) + tuple(sorted(MEDIA, key=itemgetter(1))), label=_('Is the Internet connection over mobile or fixed line?'))
def search(self): def search(self):
# By default, the search field is q. So let's check if it's empty # By default, the search field is q. So let's check if it's empty
......
...@@ -10,6 +10,7 @@ from django.contrib import messages ...@@ -10,6 +10,7 @@ from django.contrib import messages
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.db.models import Count from django.db.models import Count
from django.db import transaction
from haystack.generic_views import SearchView from haystack.generic_views import SearchView
from haystack.query import SearchQuerySet from haystack.query import SearchQuerySet
from models import Violation, Attachment, Comment, Confirmation, Operator, FeaturedCase from models import Violation, Attachment, Comment, Confirmation, Operator, FeaturedCase
...@@ -22,6 +23,8 @@ from urlparse import urljoin ...@@ -22,6 +23,8 @@ from urlparse import urljoin
from BeautifulSoup import BeautifulSoup, Comment as BComment from BeautifulSoup import BeautifulSoup, Comment as BComment
from itertools import groupby from itertools import groupby
from sheet import save_ods
def sanitizeHtml(value, base_url=None): def sanitizeHtml(value, base_url=None):
rjs = r'[\s]*(&#x.{1,7})?'.join(list('javascript:')) rjs = r'[\s]*(&#x.{1,7})?'.join(list('javascript:'))
...@@ -71,7 +74,8 @@ def activate(request): ...@@ -71,7 +74,8 @@ def activate(request):
v.activationid = actid v.activationid = actid
v.save() v.save()
messages.add_message(request, messages.INFO, _('Thank you for verifying your submission. It will be listed shortly, after we\'ve checked that the report is valid.').encode("Utf-8")) messages.add_message(request, messages.INFO, _('Thank you for verifying your submission. It will be listed shortly, after we\'ve checked that the report is valid.').encode("Utf-8"))
return HttpResponseRedirect('/') # Redirect after POST return HttpResponseRedirect('/') # Redirect after POST
def moderate(request): def moderate(request):
try: try:
...@@ -109,9 +113,6 @@ def moderate(request): ...@@ -109,9 +113,6 @@ def moderate(request):
return render_to_response('view.html', {'v': v, 'key': request.GET.get('key')}, context_instance=RequestContext(request)) return render_to_response('view.html', {'v': v, 'key': request.GET.get('key')}, context_instance=RequestContext(request))
from django.db import transaction
@transaction.atomic @transaction.atomic
def confirm(request, id, name=None): def confirm(request, id, name=None):
...@@ -204,13 +205,13 @@ class AddForm(FormView): ...@@ -204,13 +205,13 @@ class AddForm(FormView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(AddForm, self).get_context_data(**kwargs) context = super(AddForm, self).get_context_data(**kwargs)
reports = sorted([(i['total'],i['id']) reports = sorted([(i['total'], i['id'])
for i in Violation.objects.values('id').exclude(state__in=['closed', 'ooscope', 'duplicate']).exclude(old=True).annotate(total=Count('confirmation'))], for i in Violation.objects.values('id').exclude(state__in=['closed', 'ooscope', 'duplicate']).exclude(old=True).annotate(total=Count('confirmation'))],
reverse=True) reverse=True)
confirms = sorted([(i['total'],i['country']) confirms = sorted([(i['total'], i['country'])
for i in Violation.objects.values('country').exclude(state__in=['closed', 'ooscope', 'duplicate']).exclude(old=True).annotate(total=Count('confirmation'))], for i in Violation.objects.values('country').exclude(state__in=['closed', 'ooscope', 'duplicate']).exclude(old=True).annotate(total=Count('confirmation'))],
reverse=True) reverse=True)
operators = sorted([(i['total'],i['operator_ref__name']) operators = sorted([(i['total'], i['operator_ref__name'])
for i in Violation.objects.values('operator_ref__name').exclude(state__in=['closed', 'ooscope', 'duplicate']).exclude(old=True).annotate(total=Count('confirmation'))], for i in Violation.objects.values('operator_ref__name').exclude(state__in=['closed', 'ooscope', 'duplicate']).exclude(old=True).annotate(total=Count('confirmation'))],
reverse=True) reverse=True)
context['stats'] = [ context['stats'] = [
...@@ -337,9 +338,6 @@ def ascsv(request): ...@@ -337,9 +338,6 @@ def ascsv(request):
return response return response
from sheet import save_ods
def asods(request): def asods(request):
response = HttpResponse(mimetype='application/vnd.oasis.opendocument.spreadsheet') response = HttpResponse(mimetype='application/vnd.oasis.opendocument.spreadsheet')
response['Content-Disposition'] = 'attachment; filename=respectmynet-ec_berec_tm_questionnaire.ods' response['Content-Disposition'] = 'attachment; filename=respectmynet-ec_berec_tm_questionnaire.ods'
......
...@@ -86,7 +86,7 @@ urlpatterns = patterns('', ...@@ -86,7 +86,7 @@ urlpatterns = patterns('',
url(r'^i18n/', include('django.conf.urls.i18n')), url(r'^i18n/', include('django.conf.urls.i18n')),
) )
if settings.DEV_SERVER == True: if settings.DEV_SERVER is True:
urlpatterns += patterns('', urlpatterns += patterns('',
(r'^site_media/(?P<path>.*)$', (r'^site_media/(?P<path>.*)$',
'django.views.static.serve', 'django.views.static.serve',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment