Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/pynslcd/usermod.py
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2013-04-12 11:02:38 +0200
committerArthur de Jong <arthur@arthurdejong.org>2013-04-12 11:08:25 +0200
commitb15dc66dcd4f85e06b112568fe154d3e7c7659da (patch)
tree6e51590b9ba4b081f04da242b35896e240909cf0 /pynslcd/usermod.py
parentd3c6a66ac3b76b571fcb2377b0edf41c4c67a4d5 (diff)
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.
Diffstat (limited to 'pynslcd/usermod.py')
-rw-r--r--pynslcd/usermod.py10
1 files changed, 4 insertions, 6 deletions
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