Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30428/spambayes
Modified Files:
ProxyUI.py message.py
Log Message:
Don't overwrite existing attributes even if the message isn't already in the
database.
Add a function to remove (if present) the subject/to notations. Do so when
removing
all SB headers, as this is symmetric with adding and is typically what we want
(we
usually remove in order to train, and don't want them present then).
Remove notations before adding messages to the review page.
Adds [ 848365 ] Remove subject annotations from message review page
Index: ProxyUI.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/ProxyUI.py,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** ProxyUI.py 28 Nov 2004 23:38:17 -0000 1.53
--- ProxyUI.py 8 Dec 2004 03:34:29 -0000 1.54
***************
*** 681,685 ****
bodySummary and other header (as needed) attributes. These objects
are passed into appendMessages by onReview - passing email.Message
! objects directly uses too much memory."""
subjectHeader = message["Subject"] or "(none)"
headers = {"subject" : subjectHeader}
--- 681,689 ----
bodySummary and other header (as needed) attributes. These objects
are passed into appendMessages by onReview - passing email.Message
! objects directly uses too much memory.
! """
! # Remove notations before displaying - see:
! # [ 848365 ] Remove subject annotations from message review page
! message.delNotations()
subjectHeader = message["Subject"] or "(none)"
headers = {"subject" : subjectHeader}
Index: message.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/message.py,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** message.py 29 Nov 2004 00:17:59 -0000 1.60
--- message.py 8 Dec 2004 03:34:29 -0000 1.61
***************
*** 132,136 ****
# Set to None, as it's not there.
for att in msg.stored_attributes:
! setattr(msg, att, None)
else:
if not isinstance(attributes, types.ListType):
--- 132,138 ----
# Set to None, as it's not there.
for att in msg.stored_attributes:
! # Don't overwrite.
! if not hasattr(msg, att):
! setattr(msg, att, None)
else:
if not isinstance(attributes, types.ListType):
***************
*** 452,458 ****
self[headerName] = "".join(wrappedEvd)
! # These are pretty ugly, but no-one has a better idea about how to
! # allow filtering in 'stripped down' mailers like Outlook Express,
! # so for the moment, they stay in.
# options["Headers", "notate_to"] (and notate_subject) can be
# either a single string (like "spam") or a tuple (like
--- 454,471 ----
self[headerName] = "".join(wrappedEvd)
! if options['Headers','add_unique_id']:
! self[options['Headers','mailid_header_name']] = self.id
!
! self.addNotations()
!
! def addNotations(self):
! """Add the appropriate string to the subject: and/or to: header.
!
! This is a reasonably ugly method of including the classification,
! but no-one has a better idea about how to allow filtering in
! 'stripped down' mailers (i.e. Outlook Express), so, for the moment,
! this is it.
! """
! disposition = self.GetClassification()
# options["Headers", "notate_to"] (and notate_subject) can be
# either a single string (like "spam") or a tuple (like
***************
*** 488,493 ****
self["Subject"] = disposition
! if options['Headers','add_unique_id']:
! self[options['Headers','mailid_header_name']] = self.id
def currentSBHeaders(self):
--- 501,540 ----
self["Subject"] = disposition
! def delNotations(self):
! """If present, remove our notation from the subject: and/or to:
! header of the message.
!
! This is somewhat problematic, as we cannot be 100% positive that we
! added the notation. It's almost certain to be us with the to:
! header, but someone else might have played with the subject:
! header. However, as long as the user doesn't turn this option on
! and off, this will all work nicely.
!
! See also [ 848365 ] Remove subject annotations from message review
! page
! """
! subject = self["Subject"]
! ham = options["Headers", "header_ham_string"] + ','
! spam = options["Headers", "header_spam_string"] + ','
! unsure = options["Headers", "header_unsure_string"] + ','
! if options["Headers", "notate_subject"]:
! for disp in (ham, spam, unsure):
! if subject.startswith(disp):
! self.replace_header("Subject", subject[len(disp):])
! # Only remove one, maximum.
! break
! to = self["To"]
! ham = "[EMAIL PROTECTED];" % \
! (options["Headers", "header_ham_string"],)
! spam = "[EMAIL PROTECTED];" % \
! (options["Headers", "header_spam_string"],)
! unsure = "[EMAIL PROTECTED];" % \
! (options["Headers", "header_unsure_string"],)
! if options["Headers", "notate_to"]:
! for disp in (ham, spam, unsure):
! if to.startswith(disp):
! self.replace_header("To", to[len(disp):])
! # Only remove one, maximum.
! break
def currentSBHeaders(self):
***************
*** 517,520 ****
--- 564,570 ----
del self[options['Headers','score_header_name']]
del self[options['Headers','trained_header_name']]
+ # Also delete notations - typically this is called just before
+ # training, and we don't want them there for that.
+ self.delNotations()
# Utility function to insert an exception header into the given RFC822 text.
_______________________________________________
Spambayes-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/spambayes-checkins