[Spambayes-checkins] spambayes/scripts sb_imapfilter.py,1.10,1.11

Tony Meyer anadelonbrin at users.sourceforge.net
Thu Oct 2 22:59:42 EDT 2003


Update of /cvsroot/spambayes/spambayes/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv31325/scripts

Modified Files:
	sb_imapfilter.py 
Log Message:
Hopefully fix [ spambayes-Bugs-816400 ] Crash because of bad date.  If appending fails, we now try without the flags, without the date, and without both (which means that information is lost).

In theory, we're only copying this information, so it should be all ok, but in 
practice imap is a PITA.

Index: sb_imapfilter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_imapfilter.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** sb_imapfilter.py	2 Oct 2003 08:08:19 -0000	1.10
--- sb_imapfilter.py	3 Oct 2003 02:59:40 -0000	1.11
***************
*** 408,421 ****
              flags = None
  
!         response = imap.append(self.folder.name, flags,
!                                msg_time, self.as_string())
!         if response[0] == "NO":
!             # This may be because we have tried to set an invalid flag.
!             # Try again, losing all the flag information, but warn the
!             # user that this has happened.
!             response = imap.append(self.folder.name, None, msg_time,
                                     self.as_string())
              if response[0] == "OK":
!                 print "WARNING: Could not append flags: %s" % (flags,)
          self._check(response, 'append')
  
--- 408,419 ----
              flags = None
  
!         for flgs, tme in [(flags, msg_time),
!                           (None, msg_time),
!                           (flags, Time2Internaldate(time.time())),
!                           (None, Time2Internaldate(time.time()))]:
!             response = imap.append(self.folder.name, flgs, tme,
                                     self.as_string())
              if response[0] == "OK":
!                 break
          self._check(response, 'append')
  





More information about the Spambayes-checkins mailing list