[Spambayes-checkins] spambayes/scripts sb_pop3dnd.py,1.9,1.10
Tony Meyer
anadelonbrin at users.sourceforge.net
Wed Jul 14 09:17:02 CEST 2004
Update of /cvsroot/spambayes/spambayes/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32171/scripts
Modified Files:
sb_pop3dnd.py
Log Message:
Allow IMAPMessages to be created without any arguments, so that they
are compatible with emal.Parser. Add in assert statements to ensure
that the required information is still entered.
Avoid using setPayload.
Index: sb_pop3dnd.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_pop3dnd.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** sb_pop3dnd.py 19 Jan 2004 17:58:20 -0000 1.9
--- sb_pop3dnd.py 14 Jul 2004 07:16:59 -0000 1.10
***************
*** 153,157 ****
__implements__ = (IMessage,)
! def __init__(self, date):
message.Message.__init__(self)
# We want to persist more information than the generic
--- 153,157 ----
__implements__ = (IMessage,)
! def __init__(self, date=None):
message.Message.__init__(self)
# We want to persist more information than the generic
***************
*** 192,195 ****
--- 192,197 ----
def getInternalDate(self):
"""Retrieve the date internally associated with this message."""
+ assert(self.date is not None,
+ "Must set date to use IMAPMessage instance.")
return self.date
***************
*** 338,342 ****
self.load()
def load(self):
! self.setPayload(self.func(body=True, headers=True))
--- 340,344 ----
self.load()
def load(self):
! self.set_payload(self.func(body=True, headers=True))
***************
*** 468,474 ****
def addMessage(self, content, flags=(), date=None):
"""Add the given message to this mailbox."""
! msg = self.storage.makeMessage(self.getUIDNext(True))
msg.date = date
- msg.setPayload(content.read())
self.storage.addMessage(msg)
self.store(MessageSet(long(msg.id), long(msg.id)), flags, 1, True)
--- 470,476 ----
def addMessage(self, content, flags=(), date=None):
"""Add the given message to this mailbox."""
! msg = self.storage.makeMessage(self.getUIDNext(True),
! content.read())
msg.date = date
self.storage.addMessage(msg)
self.store(MessageSet(long(msg.id), long(msg.id)), flags, 1, True)
***************
*** 606,611 ****
'See <http://spambayes.org>.\r\n'
date = imaplib.Time2Internaldate(time.time())[1:-1]
! msg = IMAPMessage(date)
! msg.setPayload(about)
self.addMessage(msg)
msg = DynamicIMAPMessage(self.buildStatusMessage)
--- 608,614 ----
'See <http://spambayes.org>.\r\n'
date = imaplib.Time2Internaldate(time.time())[1:-1]
! msg = email.message_from_string(about, _class=IMAPMessage,
! strict=False)
! msg.date = date
self.addMessage(msg)
msg = DynamicIMAPMessage(self.buildStatusMessage)
***************
*** 823,828 ****
try:
! msg = message.SBHeaderMessage()
! msg.setPayload(messageText)
# Now find the spam disposition and add the header.
(prob, clues) = state.bayes.spamprob(msg.asTokens(),\
--- 826,830 ----
try:
! msg = message.sbheadermessage_from_string(messageText)
# Now find the spam disposition and add the header.
(prob, clues) = state.bayes.spamprob(msg.asTokens(),\
More information about the Spambayes-checkins
mailing list