projects
/
mirror
/
userdir-ldap.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use "foo is None" instead of "foo == None".
[mirror/userdir-ldap.git]
/
ud-forwardlist
diff --git
a/ud-forwardlist
b/ud-forwardlist
index
9e5e28a
..
68c8c1d
100755
(executable)
--- a/
ud-forwardlist
+++ b/
ud-forwardlist
@@
-12,16
+12,16
@@
#
# It also understand .qmail type files
#
# It also understand .qmail type files
-import
string,
re, time, getopt, os, sys, pwd, stat;
+import re, time, getopt, os, sys, pwd, stat;
AddressSplit = re.compile("<(.*)>");
while (1):
AddressSplit = re.compile("<(.*)>");
while (1):
- File = s
tring.strip(sys.stdin.readline());
+ File = s
ys.stdin.readline().strip()
if File == "":
break;
if File == "":
break;
- # Attempt to determine the UID
+ # Attempt to determine the UID
try:
User = pwd.getpwuid(os.stat(File)[stat.ST_UID])[0];
except KeyError:
try:
User = pwd.getpwuid(os.stat(File)[stat.ST_UID])[0];
except KeyError:
@@
-32,30
+32,30
@@
while (1):
Forward = open(File,"r");
Line = None;
while (1):
Forward = open(File,"r");
Line = None;
while (1):
- Line2 =
string.strip(Forward.readline());
+ Line2 =
Forward.readline().strip()
if Line2 == "":
break;
if Line2[0] == '#' or Line2[0] == '\n':
continue;
if Line2 == "":
break;
if Line2[0] == '#' or Line2[0] == '\n':
continue;
- if Line
==
None:
+ if Line
is
None:
Line = Line2;
else:
break;
# If we got more than one line or no lines at all it is invalid
Line = Line2;
else:
break;
# If we got more than one line or no lines at all it is invalid
- if Line
==
None or Line == "" or Line2 != "":
+ if Line
is
None or Line == "" or Line2 != "":
print "Invalid1", File;
continue;
# Abort for funky things like pipes or directions to mailboxes
if Line[0] == '/' or Line[0] == '|' or Line[0] == '.' or Line[-1] == '/' or \
print "Invalid1", File;
continue;
# Abort for funky things like pipes or directions to mailboxes
if Line[0] == '/' or Line[0] == '|' or Line[0] == '.' or Line[-1] == '/' or \
-
string.find(Line,
'@') == -1:
+
Line.find(
'@') == -1:
print "Invalid2", File;
continue;
# Split off the address part
Address = AddressSplit.match(Line);
print "Invalid2", File;
continue;
# Split off the address part
Address = AddressSplit.match(Line);
- if Address
== None:
+ if Address
is None:
# Or parse a qmail adddress..
Address = Line;
if Address[0] == '&':
# Or parse a qmail adddress..
Address = Line;
if Address[0] == '&':