From b15dc66dcd4f85e06b112568fe154d3e7c7659da Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Fri, 12 Apr 2013 11:02:38 +0200 Subject: Python style changes This tries to conform more closely to PEP8. Imports have been checked and, if used only once, moved closer to the use to avoid potential import loops. This also includes a few other minor changes, like using __main__ for utility scripts and variable renames to avoid name clashes. --- pynslcd/usermod.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'pynslcd/usermod.py') diff --git a/pynslcd/usermod.py b/pynslcd/usermod.py index c957b97..9622fb2 100644 --- a/pynslcd/usermod.py +++ b/pynslcd/usermod.py @@ -26,9 +26,7 @@ import os.path import ldap -import cache import cfg -import common import constants import pam import passwd @@ -94,10 +92,10 @@ class UserModRequest(pam.PAMRequest): mods.append((ldap.MOD_REPLACE, passwd.attmap['homeDirectory'], [homedir])) elif not os.path.isabs(homedir): self.write_result(constants.NSLCD_USERMOD_HOMEDIR, - 'should be an absolute path') + 'should be an absolute path') elif not os.path.isdir(homedir): self.write_result(constants.NSLCD_USERMOD_HOMEDIR, - 'not a directory') + 'not a directory') else: mods.append((ldap.MOD_REPLACE, passwd.attmap['homeDirectory'], [homedir])) # check login shell modification @@ -107,10 +105,10 @@ class UserModRequest(pam.PAMRequest): mods.append((ldap.MOD_REPLACE, passwd.attmap['loginShell'], [shell])) elif shell not in list_shells(): self.write_result(constants.NSLCD_USERMOD_SHELL, - 'unlisted shell') + 'unlisted shell') elif not os.path.isfile(shell) or not os.access(shell, os.X_OK): self.write_result(constants.NSLCD_USERMOD_SHELL, - 'not an executable') + 'not an executable') else: mods.append((ldap.MOD_REPLACE, passwd.attmap['loginShell'], [shell])) # get a connection and perform the modification -- cgit v1.2.3