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

SourceForge.net noreply at sourceforge.net
Thu Jul 3 22:45:38 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 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