From: Peter Palfrader Date: Sat, 21 May 2011 14:03:21 +0000 (+0200) Subject: naming your variable like a module is unsmart X-Git-Tag: userdir-ldap-0.3.85~105 X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=commitdiff_plain;h=703033b7eeaffc61568300877d2d452651388acf naming your variable like a module is unsmart --- diff --git a/debian/changelog b/debian/changelog index 6d80f95..c00bde2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,9 @@ userdir-ldap (0.3.XXX) UNRELEASED; urgency=low * some ud-echelon fixes, * userdir_gpg.py: GetClearSig: add lax_multipart to deal with random multipart mails. + * naming your variable like a module is unsmart. - -- Peter Palfrader Sat, 21 May 2011 15:12:23 +0200 + -- Peter Palfrader Sat, 21 May 2011 16:03:00 +0200 userdir-ldap (0.3.79) unstable; urgency=low diff --git a/sigcheck b/sigcheck index fc16d1f..69db152 100755 --- a/sigcheck +++ b/sigcheck @@ -129,12 +129,12 @@ try: # Get the email ErrType = EX_PERMFAIL; ErrMsg = "Failed to understand the email or find a signature:"; - email = email.parser.Parser().parse(sys.stdin); - MsgID = email["Message-ID"] + mail = email.parser.Parser().parse(sys.stdin); + MsgID = mail["Message-ID"] print "Inspecting message %s"%MsgID; verbmsg("Processing message %s" % MsgID) - Msg = GetClearSig(email,1); + Msg = GetClearSig(mail,1); if AllowMIME == 0 and Msg[1] != 0: raise Error, "PGP/MIME disallowed"; diff --git a/ud-echelon b/ud-echelon index 1bd90ca..38e0718 100755 --- a/ud-echelon +++ b/ud-echelon @@ -11,10 +11,10 @@ EX_PERMFAIL = 65; # EX_DATAERR Debug = None; # Try to extract a key fingerprint from a PGP siged message -def TryGPG(email): +def TryGPG(mail): # Try to get a pgp text try: - Msg = GetClearSig(email, lax_multipart=True); + Msg = GetClearSig(mail, lax_multipart=True); except: # Log an exception.. but continue. This is to deal with 'sort of' # PGP-MIME things @@ -30,7 +30,7 @@ def TryGPG(email): # Failed to find a matching sig if not pgp.ok: - S = "%s: %s -> PGP Checking failed '%s': %s %s\n" %(Now,MsgID,email["From"],str(pgp.why),str(pgp.key_info)); + S = "%s: %s -> PGP Checking failed '%s': %s %s\n" %(Now,MsgID,mail["From"],str(pgp.why),str(pgp.key_info)); ErrLog.write(S); return None; @@ -44,8 +44,8 @@ def TryGPG(email): return (Attrs[0][1]["uid"][0],"PGP",FormatPGPKey(pgp.key_fpr)); # Try to guess the name from the email address -def TryMatcher(email): - Sender = email["From"]; +def TryMatcher(mail): + Sender = mail["From"]; if Sender == None: return None; @@ -88,8 +88,8 @@ try: # Get the email ErrType = EX_PERMFAIL; ErrMsg = "Failed to understand the email or find a signature:"; - email = email.parser.Parser().parse(sys.stdin); - MsgID = email["Message-ID"] + mail = email.parser.Parser().parse(sys.stdin); + MsgID = mail["Message-ID"] # Connect to the ldap server ErrType = EX_TEMPFAIL; @@ -107,13 +107,13 @@ try: # Try to decode ErrType = EX_TEMPFAIL; ErrMsg = "An error occured while trying GPG decoding"; - User = TryGPG(email); + User = TryGPG(mail); if User == None: ErrMsg = "An error occured while trying Matcher decoding"; - User = TryMatcher(email); + User = TryMatcher(mail); # Get any mailing list information - List = email['X-Mailing-List'] + List = mail['X-Mailing-List'] if not List: List = "-"; # Tada, write a log message @@ -127,7 +127,7 @@ try: else: print Rec; else: - User = ("-","UKN",email["From"]); + User = ("-","UKN",mail["From"]); Msg = "[%s] \"%s\" \"%s\" \"%s\""%(Now,User[2],List,MsgID); MainLog.write("%s %s %s\n"%(User[0],User[1],Msg)); diff --git a/ud-mailgate b/ud-mailgate index 8439037..1ec0e9f 100755 --- a/ud-mailgate +++ b/ud-mailgate @@ -752,8 +752,8 @@ try: # Get the email ErrType = EX_PERMFAIL; ErrMsg = "Failed to understand the email or find a signature:"; - email = email.parser.Parser().parse(sys.stdin); - Msg = GetClearSig(email); + mail = email.parser.Parser().parse(sys.stdin); + Msg = GetClearSig(mail); ErrMsg = "Message is not PGP signed:" if Msg[0].find("-----BEGIN PGP SIGNED MESSAGE-----") == -1 and \ @@ -802,8 +802,8 @@ try: # Determine the sender address ErrMsg = "A problem occured while trying to formulate the reply"; - Sender = email['Reply-To'] - if not Sender: Sender = email['From'] + Sender = mail['Reply-To'] + if not Sender: Sender = mail['From'] if not Sender: raise UDFormatError, "Unable to determine the sender's address"; # Formulate a reply