diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c39b7a5..1a8d21c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -11,7 +11,6 @@
pep8:
script:
- tox -e pep8
- allow_failure: true
django-latest:
script:
diff --git a/src/postorius/auth/decorators.py b/src/postorius/auth/decorators.py
index 2791825..ad3aa07 100644
--- a/src/postorius/auth/decorators.py
+++ b/src/postorius/auth/decorators.py
@@ -30,7 +30,7 @@
if request.user.is_authenticated():
print('already logged in')
if not request.user.is_authenticated():
- if request.META.has_key('HTTP_AUTHORIZATION'):
+ if 'HTTP_AUTHORIZATION' in request.META:
authmeth, auth = request.META['HTTP_AUTHORIZATION'].split(' ',
1)
if authmeth.lower() == 'basic':
diff --git a/src/postorius/context_processors.py b/src/postorius/context_processors.py
index 9dfff0f..934651f 100644
--- a/src/postorius/context_processors.py
+++ b/src/postorius/context_processors.py
@@ -49,6 +49,6 @@
'request': request,
'hyperkitty_url': hyperkitty_url,
# Resolve the login and logout URLs from the settings
- 'login_url': resolve_url(settings.LOGIN_URL),
+ 'login_url': resolve_url(settings.LOGIN_URL),
'logout_url': resolve_url(settings.LOGOUT_URL),
}
diff --git a/src/postorius/forms.py b/src/postorius/forms.py
index 14638f4..2a1af6e 100644
--- a/src/postorius/forms.py
+++ b/src/postorius/forms.py
@@ -192,15 +192,15 @@
"""
email = forms.ChoiceField(
- label=_('Your email address'),
- validators=[validate_email],
- widget=forms.Select(),
- error_messages={
- 'required': _('Please enter an email address.'),
- 'invalid': _('Please enter a valid email address.')})
+ label=_('Your email address'),
+ validators=[validate_email],
+ widget=forms.Select(),
+ error_messages={
+ 'required': _('Please enter an email address.'),
+ 'invalid': _('Please enter a valid email address.')})
- display_name = forms.CharField(label=_('Your name (optional)'),
- required=False)
+ display_name = forms.CharField(
+ label=_('Your name (optional)'), required=False)
def __init__(self, user_emails, *args, **kwargs):
super(ListSubscribe, self).__init__(*args, **kwargs)
@@ -826,14 +826,14 @@
# Check if the address belongs to someone else
if User.objects.filter(email=email).exists():
raise forms.ValidationError(
- _('This email is in use. Please choose another or contact'
- ' the administrator'), 'error')
+ _('This email is in use. Please choose another or contact'
+ ' the administrator'), 'error')
# Check if the email is attached to a user in Mailman
try:
utils.get_client().get_user(email)
raise forms.ValidationError(
- _('This email already belongs to a user'), 'error')
+ _('This email already belongs to a user'), 'error')
except HTTPError:
pass
return email
diff --git a/src/postorius/lib/scrub.py b/src/postorius/lib/scrub.py
index f0995df..86952a6 100644
--- a/src/postorius/lib/scrub.py
+++ b/src/postorius/lib/scrub.py
@@ -170,4 +170,4 @@
if ctype == 'message/rfc822':
submsg = part.get_payload()
decodedpayload = str(submsg)
- return (counter, filebase+ext, ctype, charset, decodedpayload)
+ return (counter, filebase + ext, ctype, charset, decodedpayload)
diff --git a/src/postorius/models.py b/src/postorius/models.py
index f57403c..854dcc8 100644
--- a/src/postorius/models.py
+++ b/src/postorius/models.py
@@ -276,8 +276,8 @@
# the setting or the default
if not template_path:
template_path = getattr(
- settings, 'EMAIL_CONFIRMATION_TEMPLATE',
- 'postorius/user/address_confirmation_message.txt')
+ settings, 'EMAIL_CONFIRMATION_TEMPLATE',
+ 'postorius/user/address_confirmation_message.txt')
# Create a template context (if there is none) containing
# the activation_link and the host_url.
if not template_context:
diff --git a/src/postorius/tests/mailman_api_tests/test_address_activation.py b/src/postorius/tests/mailman_api_tests/test_address_activation.py
index 2e4ddf0..90c620a 100644
--- a/src/postorius/tests/mailman_api_tests/test_address_activation.py
+++ b/src/postorius/tests/mailman_api_tests/test_address_activation.py
@@ -38,15 +38,15 @@
super(TestAddressActivationForm, self).setUp()
# Create a user and profile.
self.user = User.objects.create_user(
- 'testuser', 'les@example.org', 'testpass')
+ 'testuser', 'les@example.org', 'testpass')
self.profile = AddressConfirmationProfile.objects.create(
- email='les2@example.org', user=self.user)
+ email='les2@example.org', user=self.user)
self.expired = AddressConfirmationProfile.objects.create(
- email='expired@example.org', user=self.user)
+ email='expired@example.org', user=self.user)
self.expired.created -= timedelta(weeks=100)
self.expired.save()
self.mm_user = self.mm_client.create_user(
- 'subscribed@example.org', 'password')
+ 'subscribed@example.org', 'password')
def test_valid_email_is_valid(self):
form = AddressActivationForm({'email': 'very_new_email@example.org'})
@@ -82,7 +82,7 @@
username=u'ler_mm', email=u'ler@mailman.mostdesirable.org',
password=u'pwd')
self.profile = AddressConfirmationProfile.objects.create(
- email=u'les@example.org', user=self.user)
+ email=u'les@example.org', user=self.user)
# Create a test request object
self.request = RequestFactory().get('/')
@@ -156,7 +156,7 @@
password='pwd')
self.mm_user = self.mm_client.create_user('ler@example.org', None)
self.profile = AddressConfirmationProfile.objects.create(
- email=u'les@example.org', user=self.user)
+ email=u'les@example.org', user=self.user)
self.profile.save()
def test_add_address(self):
diff --git a/src/postorius/tests/mailman_api_tests/test_list_bans.py b/src/postorius/tests/mailman_api_tests/test_list_bans.py
index afca78a..a071b7a 100644
--- a/src/postorius/tests/mailman_api_tests/test_list_bans.py
+++ b/src/postorius/tests/mailman_api_tests/test_list_bans.py
@@ -17,7 +17,7 @@
"""Tests for ban lists"""
-from __future__ import absolute_import, print_function, unicode_literals
+from __future__ import absolute_import, print_function, unicode_literals
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
@@ -59,11 +59,11 @@
self.assertEqual(response.status_code, 200)
self.assertTrue('addban_form' in response.context)
self.assertContains(
- response, '')
+ response, '')
self.assertContains(
- response, '')
+ response, '')
def test_context_contains_delete_forms(self):
banned = ['banned{}@example.com'.format(i) for i in range(1, 10)]
@@ -73,11 +73,12 @@
self.assertEqual(response.status_code, 200)
for ban in banned:
self.assertContains(
- response, ''
- % ban)
+ response,
+ '' % ban)
self.assertContains(
- response, '