[Spambayes-checkins] spambayes/scripts sb_imapfilter.py,1.34,1.35

Tony Meyer anadelonbrin at users.sourceforge.net
Wed Aug 4 10:32:29 CEST 2004


Update of /cvsroot/spambayes/spambayes/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10643/scripts

Modified Files:
	sb_imapfilter.py 
Log Message:
Update some comments.

Move _extract_fetch_data to be a method of the IMAPSession.

Add doctsrings.

Be less restrictive about the error returned when logging in fails.

Centralise checking the IMAP response into an IMAPSession method.  Raise
a BadIMAPResponseError exception if it is not right (and that can either be
caught or not, depending on whether it's fatal).

Remove FindMessage() which no-one uses.

Don't use setFolder, just do self.folder = folder.

Change the way the get_substance method works (renaming it in the process).  Now
we return a new message object, which is the same, but has the contents.  This way
we can avoid using private members of email objects.

Remove global imap object and make it a member of the various objects.

Remove the layers of attempting to fetch.  These were legacy from the days when I
wrongly used RFC822.PEEK.  BODY.PEEK should always work.

Move adding exception header out to spambayes.message

Try to do a better job of waiting for the new message to appear (to fix sf#941596).
Have to check for sure that this fixes it, yet.

Remove a useless except KeyError from __iter__

Remove recent_uids(), which no-one uses.

Switch to using the Message-ID header id as our id, unless one can't be found, in
which case we use our one.  This is often requested, as it means we don't need
to resave the message all the time.  We look for our header first, so we should still
work with old messages, but this might mean that existing messages are retrained
or refilted - I have yet to confirm this (for the WHAT_IS_NEW file).

Tidy up the Train() function.

Keep going if just one folder is bad (training/filtering).

These are *major* changes to imapfilter, so could well break something.  I have done
testing here, and have half a unittest script (checking it in shortly), but even still.  I
would appreciate testing from anyone that's running from CVS & using imapfilter.

Index: sb_imapfilter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_imapfilter.py,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** sb_imapfilter.py	19 Jul 2004 09:55:21 -0000	1.34
--- sb_imapfilter.py	4 Aug 2004 08:32:26 -0000	1.35
***************
*** 34,38 ****
                            to value
  
- 
  Examples:
  
--- 34,37 ----
***************
*** 47,73 ****
  
  Warnings:
[...1340 lines suppressed...]
      if not (doClassify or doTrain):
!         if server != "":
              imap = IMAPSession(server, port, imapDebug, doExpunge)
          httpServer = UserInterfaceServer(options["html_ui", "port"])
--- 971,977 ----
      # Web interface
      if not (doClassify or doTrain):
!         if server == "":
!             imap = None
!         else:
              imap = IMAPSession(server, port, imapDebug, doExpunge)
          httpServer = UserInterfaceServer(options["html_ui", "port"])
***************
*** 937,940 ****
--- 984,988 ----
              imap = IMAPSession(server, port, imapDebug, doExpunge)
              imap.login(username, pwd)
+             imap_filter.imap_server = imap
  
              if doTrain:



More information about the Spambayes-checkins mailing list