[Spambayes-checkins] spambayes/Outlook2000 addin.py,1.122,1.123

Mark Hammond mhammond at users.sourceforge.net
Sat Dec 20 18:10:52 EST 2003


Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory sc8-pr-cvs1:/tmp/cvs-serv7496

Modified Files:
	addin.py 
Log Message:
When doing a "batch train" (eg, selecting multiple messages and saying
"Delete as" or "Recover from",) the DB was saved in between each and every
message.  Now only saved at the end (which was always the intent)


Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.122
retrieving revision 1.123
diff -C2 -d -r1.122 -r1.123
*** addin.py	20 Dec 2003 06:25:12 -0000	1.122
--- addin.py	20 Dec 2003 23:10:50 -0000	1.123
***************
*** 78,81 ****
--- 78,94 ----
  # niceness doesn't help anyone.
  
+ # As MarkH assumed, and later found to back him up in:
+ # http://www.slipstick.com/dev/comaddins.htm:
+ # On building add-ins for multiple Outlook versions, Randy Byrne writes in
+ # the microsoft.public.office.developer.com.add_ins newsgroup, "The best
+ # practice is to compile your Add-in with OL2000 and MSO9.dll. Then your
+ # add-in will work with both OL2000 and OL2002, and CommandBar events will
+ # work with both versions. If you need to use any specific OL2002 or
+ # Office 10.0 Object Library calls, you can use late binding to address
+ # those issues. The CommandBar Events are the same in both Office
+ # 2000 and Office XP."
+ # So that is what we do: specify the minimum versions of the typelibs we
+ # can work with - ie, Outlook 2000.
+ 
  # win32com generally checks the gencache is up to date (typelib hasn't
  # changed, makepy hasn't changed, etc), but when frozen we dont want to
***************
*** 121,125 ****
  
  # Helper functions
! def TrainAsHam(msgstore_message, manager, rescore = True):
      import train
      subject = msgstore_message.subject
--- 134,138 ----
  
  # Helper functions
! def TrainAsHam(msgstore_message, manager, rescore = True, save_db = True):
      import train
      subject = msgstore_message.subject
***************
*** 137,143 ****
          print "already was trained as good"
      assert train.been_trained_as_ham(msgstore_message, manager.classifier_data)
!     manager.SaveBayesPostIncrementalTrain()
  
! def TrainAsSpam(msgstore_message, manager, rescore = True):
      import train
      subject = msgstore_message.subject
--- 150,157 ----
          print "already was trained as good"
      assert train.been_trained_as_ham(msgstore_message, manager.classifier_data)
!     if save_db:
!         manager.SaveBayesPostIncrementalTrain()
  
! def TrainAsSpam(msgstore_message, manager, rescore = True, save_db = True):
      import train
      subject = msgstore_message.subject
***************
*** 155,159 ****
      assert train.been_trained_as_spam(msgstore_message, manager.classifier_data)
      # And if the DB can save itself incrementally, do it now
!     manager.SaveBayesPostIncrementalTrain()
  
  # Function to filter a message - note it is a msgstore msg, not an
--- 169,174 ----
      assert train.been_trained_as_spam(msgstore_message, manager.classifier_data)
      # And if the DB can save itself incrementally, do it now
!     if save_db:
!         manager.SaveBayesPostIncrementalTrain()
  
  # Function to filter a message - note it is a msgstore msg, not an
***************
*** 620,624 ****
              subject = msgstore_message.GetSubject()
              print "Moving and spam training message '%s' - " % (subject,),
!             TrainAsSpam(msgstore_message, self.manager)
              # Do the new message state if necessary.
              try:
--- 635,639 ----
              subject = msgstore_message.GetSubject()
              print "Moving and spam training message '%s' - " % (subject,),
!             TrainAsSpam(msgstore_message, self.manager, save_db = False)
              # Do the new message state if necessary.
              try:
***************
*** 683,687 ****
                  # Must train before moving, else we lose the message!
                  print "Recovering to folder '%s' and ham training message '%s' - " % (restore_folder.name, subject),
!                 TrainAsHam(msgstore_message, self.manager)
                  # Do the new message state if necessary.
                  try:
--- 698,702 ----
                  # Must train before moving, else we lose the message!
                  print "Recovering to folder '%s' and ham training message '%s' - " % (restore_folder.name, subject),
!                 TrainAsHam(msgstore_message, self.manager, save_db = False)
                  # Do the new message state if necessary.
                  try:





More information about the Spambayes-checkins mailing list