[Spambayes-checkins] spambayes/scripts sb_imapfilter.py,1.41,1.42

Tony Meyer anadelonbrin at users.sourceforge.net
Tue Nov 9 01:46:14 CET 2004


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

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

Improve the order of a if statement condition.

Implement [ 940547 ] imapfilter interface available when using -l switch

Index: sb_imapfilter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_imapfilter.py,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** sb_imapfilter.py	13 Oct 2004 02:42:04 -0000	1.41
--- sb_imapfilter.py	9 Nov 2004 00:46:12 -0000	1.42
***************
*** 27,33 ****
              -l minutes  : period of time between filtering operations
              -b          : Launch a web browser showing the user interface.
-                           (If not specified, and neither the -c or -t
-                           options are used, then this will default to the
-                           value in your configuration file).
              -o section:option:value :
                            set [section, option] in the options database
--- 27,30 ----
***************
*** 58,69 ****
  
  todo = """
-     o IMAPMessage and IMAPFolder currently carry out very simple checks
-       of responses received from IMAP commands, but if the response is not
-       "OK", then the filter terminates.  Handling of these errors could be
-       much nicer.
-     o Develop a test script, like spambayes/test/test_pop3proxy.py that
-       runs through some tests (perhaps with a *real* imap server, rather
-       than a dummy one).  This would make it easier to carry out the tests
-       against each server whenever a change is made.
      o IMAP supports authentication via other methods than the plain-text
        password method that we are using at the moment.  Neither of the
--- 55,58 ----
***************
*** 76,85 ****
  """
  
! # This module is part of the spambayes project, which is Copyright 2002-4
  # The Python Software Foundation and is covered by the Python Software
  # Foundation license.
  
  __author__ = "Tony Meyer <ta-meyer at ihug.co.nz>, Tim Stone"
! __credits__ = "All the Spambayes folk."
  
  from __future__ import generators
--- 65,74 ----
  """
  
! # This module is part of the SpamBayes project, which is Copyright 2002-4
  # The Python Software Foundation and is covered by the Python Software
  # Foundation license.
  
  __author__ = "Tony Meyer <ta-meyer at ihug.co.nz>, Tim Stone"
! __credits__ = "All the SpamBayes folk."
  
  from __future__ import generators
***************
*** 98,101 ****
--- 87,91 ----
  import getopt
  import types
+ import thread
  import traceback
  import email
***************
*** 174,178 ****
          SelectFolder, rather than here, for purposes of speed."""
          # We may never have logged in, in which case we do nothing.
!         if self.do_expunge and self.logged_in:
              # Expunge messages from the ham, spam and unsure folders.
              for fol in ["spam_folder",
--- 164,168 ----
          SelectFolder, rather than here, for purposes of speed."""
          # We may never have logged in, in which case we do nothing.
!         if self.connected and self.logged_in and self.do_expunge:
              # Expunge messages from the ham, spam and unsure folders.
              for fol in ["spam_folder",
***************
*** 940,949 ****
      print "and engine %s.\n" % (get_version_string(),)
  
-     if (launchUI and (doClassify or doTrain)):
-         print """-b option is exclusive with -c and -t options.
- The user interface will be launched, but no classification
- or training will be performed.
- """
- 
      if options["globals", "verbose"]:
          print "Loading database %s..." % (bdbname),
--- 930,933 ----
***************
*** 988,993 ****
      imap_filter = IMAPFilter(classifier)
  
!     # Web interface
!     if not (doClassify or doTrain):
          if server == "":
              imap = None
--- 972,988 ----
      imap_filter = IMAPFilter(classifier)
  
!     # Web interface.  We have changed the rules about this many times.
!     # With 1.0.x, the rule is that the interface is served if we are
!     # not classifying or training.  However, this runs into the problem
!     # that if we run with -l, we might still want to edit the options,
!     # and we don't want to start a separate instance, because then the
!     # database is accessed from two processes.
!     # With 1.1.x, the rule is that the interface is also served if the
!     # -l option is used, which means it is only not served if we are
!     # doing a one-off classification/train.  In that case, there would
!     # probably not be enough time to get to the interface and interact
!     # with it (and we don't want it to die halfway through!), and we
!     # don't want to slow classification/training down, either.
!     if sleepTime or not (doClassify or doTrain):
          if server == "":
              imap = None
***************
*** 997,1003 ****
          httpServer.register(IMAPUserInterface(classifier, imap, pwd,
                                                IMAPSession))
!         Dibbler.run(launchBrowser=launchUI or options["html_ui",
!                                                       "launch_browser"])
!     else:
          while True:
              imap = IMAPSession(server, port, imapDebug, doExpunge)
--- 992,1003 ----
          httpServer.register(IMAPUserInterface(classifier, imap, pwd,
                                                IMAPSession))
!         launchBrowser=launchUI or options["html_ui", "launch_browser"]
!         if sleepTime:
!             # Run in a separate thread, as we have more work to do.
!             thread.start_new_thread(Dibbler.run, (),
!                                     {"launchBrowser":launchBrowser})
!         else:
!             Dibbler.run(launchBrowser=launchBrowser)
!     if doClassify or doTrain:
          while True:
              imap = IMAPSession(server, port, imapDebug, doExpunge)



More information about the Spambayes-checkins mailing list