From 4f2c0eee2c76a668ad8f2f4f3a95b1a64bb17924 Mon Sep 17 00:00:00 2001 From: Pavlos Ratis Date: Mon, 23 Sep 2013 13:53:15 +0300 Subject: fix pep8 errors --- okupy/accounts/views.py | 15 ++++++++++----- okupy/common/fields.py | 4 +++- okupy/common/ldap_helpers.py | 6 ++++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/okupy/accounts/views.py b/okupy/accounts/views.py index 36980ee..febe39b 100644 --- a/okupy/accounts/views.py +++ b/okupy/accounts/views.py @@ -431,10 +431,12 @@ def password_settings(request): password_settings = PasswordSettingsForm(request.POST) if password_settings.is_valid(): try: - new_password = password_settings.cleaned_data['new_password'] + new_password = password_settings.cleaned_data[ + 'new_password'] new_password_verify = password_settings.cleaned_data[ 'new_password_verify'] - old_password = password_settings.cleaned_data['old_password'] + old_password = password_settings.cleaned_data[ + 'old_password'] if old_password and (new_password == new_password_verify): for hash in list(user_info.password): @@ -576,11 +578,14 @@ def gentoo_dev_settings(request): gentoo_account_settings = GentooAccountSettingsForm(request.POST) if gentoo_account_settings.is_valid(): try: - devbug = gentoo_account_settings.cleaned_data['developer_bug'] + devbug = gentoo_account_settings.cleaned_data[ + 'developer_bug'] gentoo_join_date = gentoo_account_settings.cleaned_data[ 'gentoo_join_date'] - gentoo_mentor = gentoo_account_settings.cleaned_data['mentor'] - ssh_pubkey = gentoo_account_settings.cleaned_data['ssh_key'] + gentoo_mentor = gentoo_account_settings.cleaned_data[ + 'mentor'] + ssh_pubkey = gentoo_account_settings.cleaned_data[ + 'ssh_key'] if user_info.developer_bug != devbug: user_info.developer_bug.append(devbug) diff --git a/okupy/common/fields.py b/okupy/common/fields.py index 86754f0..c19dedc 100644 --- a/okupy/common/fields.py +++ b/okupy/common/fields.py @@ -4,6 +4,7 @@ from django.db.models import fields from ldapdb import escape_ldap_filter + class ACLField(fields.Field): def _group(self): return self.name.split('_')[1] + '.group' @@ -14,7 +15,8 @@ class ACLField(fields.Field): else: return False - def get_db_prep_lookup(self, lookup_type, value, connection, prepared=False): + def get_db_prep_lookup(self, lookup_type, value, + connection, prepared=False): "Returns field's value prepared for database lookup." return [self.get_prep_lookup(lookup_type, value)] diff --git a/okupy/common/ldap_helpers.py b/okupy/common/ldap_helpers.py index c8ac5dd..2a5250f 100644 --- a/okupy/common/ldap_helpers.py +++ b/okupy/common/ldap_helpers.py @@ -44,7 +44,8 @@ def set_secondary_password(request, password): """ Generate a secondary passsword and encrypt it in the session """ with get_bound_ldapuser(request, password) as user: secondary_password = Random.get_random_bytes(48) - request.session['secondary_password'] = cipher.encrypt(secondary_password) + request.session['secondary_password'] = \ + cipher.encrypt(secondary_password) # Clean up possible leftover secondary passwords from the LDAP account if len(user.password) > 1: for hash in list(user.password): @@ -55,7 +56,8 @@ def set_secondary_password(request, password): # don't remove unknown hashes pass # Add a new generated encrypted password to LDAP - user.password.append(ldap_md5_crypt.encrypt(b64encode(secondary_password))) + user.password.append( + ldap_md5_crypt.encrypt(b64encode(secondary_password))) user.save() -- cgit v1.2.3-65-gdbad