[Spambayes-checkins] spambayes/Outlook2000 manager.py,1.94,1.95

Mark Hammond mhammond at users.sourceforge.net
Sat Dec 20 06:21:11 EST 2003


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

Modified Files:
	manager.py 
Log Message:
As part of checking our configuration is invalid, make sure the user
hasn't set us up such that either Spam/Unsure folders isn't also being
watched for new messages, as this would confuse us greatly, and may
even explain a few of the bizarre training related bugs.


Index: manager.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/manager.py,v
retrieving revision 1.94
retrieving revision 1.95
diff -C2 -d -r1.94 -r1.95
*** manager.py	16 Dec 2003 05:06:33 -0000	1.94
--- manager.py	20 Dec 2003 11:21:09 -0000	1.95
***************
*** 827,830 ****
--- 827,857 ----
                     "Select the 'Filtering' tab to define this folders."
  
+         # Check that the user hasn't selected the same folder as both
+         # 'Spam' or 'Unsure', and 'Watch' - this would confuse us greatly.
+         ms = self.message_store
+         unsure_folder = None # unsure need not be specified.
+         if config.unsure_folder_id:
+             try:
+                 unsure_folder = ms.GetFolder(config.unsure_folder_id)
+             except ms.MsgStoreException, details:
+                 return "The unsure folder is invalid: %s" % (details,)
+         try:
+             spam_folder = ms.GetFolder(config.spam_folder_id)
+         except ms.MsgStoreException, details:
+             return "The spam folder is invalid: %s" % (details,)
+         if ok_to_enable:
+             for folder in ms.GetFolderGenerator(config.watch_folder_ids,
+                                                 config.watch_include_sub):
+                 bad_folder_type = None
+                 if unsure_folder is not None and unsure_folder == folder:
+                     bad_folder_type = "unsure"
+                     bad_folder_name = unsure_folder.GetFQName()
+                 if spam_folder == folder:
+                     bad_folder_type = "spam"
+                     bad_folder_name = spam_folder.GetFQName()
+                 if bad_folder_type is not None:
+                     return "You can not specify folder '%s' as both the " \
+                            "%s folder, and as being watched." \
+                            % (bad_folder_name, bad_folder_type)
          return None
  





More information about the Spambayes-checkins mailing list