When email address lines are read from filter textfiles in
Util.file_to_list, the lines are stripped of inline comments
(the line "[EMAIL PROTECTED] # Joe Foo" becomes "[EMAIL PROTECTED]").
However, when the filter textfiles are examined in
Util.append_to_file, to see if the string being appended already
exists, the lines aren't stripped of inline comments before checking
to see if they're identical. Since an address with a comment won't be
identical to the same address without one, the address gets added a
second time.
The following patch fixes what I believe is inconsistent behavior by
stripping inline comments from both strings in append_to_file, to
ensure that the same address won't get added twice.
I think this is a bugfix rather than a new feature, so hopefully this
can be accepted for 1.0.
Ed
diff -ur tmda.orig/TMDA/Util.py tmda-cvs-0.84/TMDA/Util.py
--- tmda.orig/TMDA/Util.py Fri Aug 1 03:22:53 2003
+++ tmda-cvs-0.84/TMDA/Util.py Wed Sep 3 11:20:46 2003
@@ -417,7 +417,9 @@
if line == '' or line[0] in '#':
continue
else:
- if string.lower(string.strip(str)) == line:
+ line = line.split(' #')[0].strip()
+ bare = str.split(' #')[0].strip()
+ if string.lower(bare) == line:
fileinput.close()
return 0
file = open(fullpathname, 'a+')