Ed Blackman <[EMAIL PROTECTED]> writes:

> 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.

Ugh.  And this has been around a long time, too.  No new code uses
string module functions; string methods are faster and don't require
the module import.  We've deliberately moved away from importing
string since we discontinued support for the Python 1.x line.  I think
a lot of us use a separate file for auto-confirmations and don't
bother commenting it, which is why we haven't found this.

> 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.

Strictly speaking, I don't thing comment-stripping 'str' is necessary,
since it is always just an email address, but it doesn't hurt and the
code is safer that way, should anyone try to use it for something
other than the implementation of the XXX_APPEND features.

> I think this is a bugfix rather than a new feature, so hopefully this
> can be accepted for 1.0.

I'll change the "string.lower(bare)" to "bare.lower()" and check it
in.  Thanks for the good catch.


Tim

_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers

Reply via email to