X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-useradd;h=0dee8c43bc211ef3bf0113455f1cca14c710ffaa;hb=refs%2Fheads%2Ffordsa;hp=8872507d3657d1a1db071ed3b0190fe43ec36772;hpb=16efeb47640693f4404729f08feeadc670ea0203;p=mirror%2Fuserdir-ldap.git diff --git a/ud-useradd b/ud-useradd index 8872507..0dee8c4 100755 --- a/ud-useradd +++ b/ud-useradd @@ -180,7 +180,7 @@ while 1: cn = GetAttr(Attrs[0],"cn"); sn = GetAttr(Attrs[0],"sn"); mn = GetAttr(Attrs[0],"mn"); - if privsub == None or privsub == "": + if privsub is None or privsub == "": privsub = " "; break; else: @@ -267,8 +267,8 @@ if Update == 0 or ForceMail == 1: CryptedPass = GPGEncrypt("Your new password is '" + Password + "'\n",\ "0x"+Keys[0][1],UsePGP2); Password = None; - if CryptedPass == None: - raise "Error","Password Encryption failed" + if CryptedPass is None: + raise Exception("Password Encryption failed") else: Pass = HashPass(Password); CryptedPass = "Your password has been set to the previously agreed value."; @@ -376,7 +376,7 @@ else: (ldap.MOD_REPLACE,"shadowExpire","")]; if privsub != " ": Rec.append((ldap.MOD_REPLACE,"privateSub",privsub)); - if Pass != None: + if Pass is not None: Rec.append((ldap.MOD_REPLACE,"userPassword","{crypt}"+Pass)); # Do it l.modify_s(Dn,Rec); @@ -397,8 +397,8 @@ Reply = TemplateSubst(Subst,open(templatepath, "r").read()) Child = os.popen("/usr/sbin/sendmail -t","w"); #Child = os.popen("cat","w"); Child.write(Reply); -if Child.close() != None: - raise Error, "Sendmail gave a non-zero return code"; +if Child.close() is not None: + raise Exception("Sendmail gave a non-zero return code") # vim:set et: # vim:set ts=3: