[spambayes-dev] [ spambayes-Bugs-761677 ] mboxtrain.py's -n option has no effect

SourceForge.net noreply at sourceforge.net
Thu Jul 3 23:01:31 EDT 2003


Bugs item #761677, was opened at 2003-06-27 20:23
Message generated for change (Comment added) made by anadelonbrin
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498103&aid=761677&group_id=61702

Category: hammie
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Christian Stork (cst)
Assigned to: Nobody/Anonymous (nobody)
Summary: mboxtrain.py's -n option has no effect

Initial Comment:
In mboxtrain.py(train) the logic for trainnew is flawed.  The 
'new' dir will never be learned.  train() should look 
something like this:


def train(h, path, is_spam, force, trainnew):
    if not os.path.exists(path):
        raise ValueError("Nonexistent path: %s" % path)
    elif os.path.isfile(path):
        mbox_train(h, path, is_spam, force)
    elif os.path.isdir(os.path.join(path, "cur")):
        maildir_train(h, os.path.join(path, "cur"), is_spam, 
force)
        if trainnew:
            maildir_train(h, os.path.join(path, "new"), is_spam, 
force)
    elif os.path.isdir(path):
        mhdir_train(h, path, is_spam, force)
    else:
        raise ValueError("Unable to determine mailbox type: " 
+ path)



----------------------------------------------------------------------

>Comment By: Tony Meyer (anadelonbrin)
Date: 2003-07-04 17:01

Message:
Logged In: YES 
user_id=552329

Bah, you're right.  That'll teach me to try and come up with a 
nice looking fix without actually checking what it was meant 
to do.  I'll check in a fix that looks just like the above <wink>.

Fixed in v1.9

----------------------------------------------------------------------

Comment By: Christian Stork (cst)
Date: 2003-07-04 16:58

Message:
Logged In: YES 
user_id=23468

I think the fix is incorrect since it does not learn the new subdir 
*in addition* to cur, but *instead* of it.

----------------------------------------------------------------------

Comment By: Tony Meyer (anadelonbrin)
Date: 2003-07-04 16:45

Message:
Logged In: YES 
user_id=552329

I agree.  As it was, the elif statement would never execute, 
because for it to be true, the previous condition would also 
need to be true, and would have been the one chosen.

Fixed in mboxtrain.py v1.8.  (I didn't do it as suggested, just
swapped the elif statements around, which should do the
trick).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498103&aid=761677&group_id=61702



More information about the spambayes-dev mailing list