Message class (was: RE: Removing pickle support from Outlook? (was RE:[Spambayes] Lostdatabase))

Meyer, Tony T.A.Meyer at massey.ac.nz
Wed Apr 9 16:33:48 EDT 2003


[Mark]
> * The distinction between "set" and "change" will escape 
>   most people, and doesn't seem to serve much purpose except
>   forcing people to call "change". Indeed, maybe "set" should
>   check if self.id is already set, and if so, remove that ID
>   from the database, or assert if that ID is still there, or
>   some such.

I'm guilty of adding the change function.  Tim had a check to make sure
that you didn't set an id if it was already set, but I needed to change
the ID for the IMAP filter.  I didn't want to undo his stuff, so I added
a new function.

I'd be happy to dump the change function and just have set.  I like the
idea of removing the id if it is already set.  Otherwise we can just
dump change and I'll change the IMAP filter to create a new message
(object) when it creates a new (imap) message.

[Mark]
> * should copy() do something with the id, such as reset it?
[Tim]
> Presumably, the message that is being copied into already has 
> an unique id set, or will at some point.  This is more like a
> clone operation, an adaptation for the imap filter, which cannot
> simply modify a message.  It must create a new message, with a
> new id, and store it, then delete the old one.  A copy (clone,
> whatever) operation facilitates that process.

I haven't managed to look at it properly since Tim made these changes
(busy day), but I think that the copy should go since it's expensive
(the payload copy) and really only of use for IMAP.  I'll modify the
(derived) IMAPMessage class to create a new Message object with the
correct key, and do the payload (etc) copy.

[Mark]
> >* All the "isCls" and "clsfy" methods, and training versions are 
> >suspect.
I agree that this should be changed.

[Mark]
> >  GetSpamClassification(self):
> >    return None, True or False
> >  RememberSpamClassification(self, isSpam):
> >    void
> >  GetSpamTrained(self):
> >    return None, True or False
> >  RememberSpamTrained(self, isSpam):
> >    void
[Tim]
> Here we might have a bit of a problem.  The notesfilter 
> really does have to know if a message has ever been classified,

What about:
GetClassification(self): & GetTrained(self):
    return None, "spam", "ham", "unsure" (these could use the options.
values)
RememberClassification and RememberTrained could be the same.

None, True and False is ok, but what about unsures?  (Ok, you can't
train as unsure, but you can be classified as such, and it's nice if
they look kinda the same).

=Tony Meyer



More information about the Spambayes mailing list