[Spambayes-checkins] spambayes/Outlook2000 addin.py,1.4,1.5

Tim Peters tim_one@users.sourceforge.net
Sun, 20 Oct 2002 09:10:24 -0700


Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory usw-pr-cvs1:/tmp/cvs-serv8051

Modified Files:
	addin.py 
Log Message:
FutureWarning doesn't exist before 2.3, so don't try to access it from
Pythons older than that.


Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** addin.py	20 Oct 2002 12:20:52 -0000	1.4
--- addin.py	20 Oct 2002 16:10:22 -0000	1.5
***************
*** 1,9 ****
  # Mark's Outlook addin
  
! 
  import warnings
- warnings.filterwarnings("ignore", category=FutureWarning, append=1) # sick off the new hex() warnings!
  
! import sys
  
  from win32com import universal
--- 1,10 ----
  # Mark's Outlook addin
  
! import sys
  import warnings
  
! if sys.version_info >= (2, 3):
!     # sick off the new hex() warnings!
!     warnings.filterwarnings("ignore", category=FutureWarning, append=1)
  
  from win32com import universal
***************
*** 52,56 ****
          if exc:
              print "Exception: %s" % (exc)
!         print 
          print "Sorry, I can't be more help, but I can't continue while I have this error."
      else:
--- 53,57 ----
          if exc:
              print "Exception: %s" % (exc)
!         print
          print "Sorry, I can't be more help, but I can't continue while I have this error."
      else:
***************
*** 133,137 ****
      hammie = mgr.MakeHammie()
      prob, clues = hammie.score(text, evidence=True)
!     
      new_msg = app.CreateItem(0)
      body = "<h2>Calculated Probability: %.2f</h2><br>" % (prob,)
--- 134,138 ----
      hammie = mgr.MakeHammie()
      prob, clues = hammie.score(text, evidence=True)
! 
      new_msg = app.CreateItem(0)
      body = "<h2>Calculated Probability: %.2f</h2><br>" % (prob,)
***************
*** 167,171 ****
          assert self.manager.addin is None, "Should not already have an addin"
          self.manager.addin = self
!         
          # ActiveExplorer may be none when started without a UI (eg, WinCE synchronisation)
          activeExplorer = application.ActiveExplorer()
--- 168,172 ----
          assert self.manager.addin is None, "Should not already have an addin"
          self.manager.addin = self
! 
          # ActiveExplorer may be none when started without a UI (eg, WinCE synchronisation)
          activeExplorer = application.ActiveExplorer()
***************
*** 179,183 ****
              popup.Enabled = True
              popup = CastTo(popup, "CommandBarPopup")
!             
              item = popup.Controls.Add(Type=constants.msoControlButton, Temporary=True)
              # Hook events for the item
--- 180,184 ----
              popup.Enabled = True
              popup = CastTo(popup, "CommandBarPopup")
! 
              item = popup.Controls.Add(Type=constants.msoControlButton, Temporary=True)
              # Hook events for the item
***************
*** 202,206 ****
          # Create a notification hook for all folders we filter.
          self.UpdateFolderHooks()
!         
      def UpdateFolderHooks(self):
          new_hooks = {}
--- 203,207 ----
          # Create a notification hook for all folders we filter.
          self.UpdateFolderHooks()
! 
      def UpdateFolderHooks(self):
          new_hooks = {}
***************
*** 225,229 ****
                  self.folder_hooks[k]._obj_.close()
          self.folder_hooks = new_hooks
!             
      def OnDisconnection(self, mode, custom):
          print "SpamAddin - Disconnecting from Outlook"
--- 226,230 ----
                  self.folder_hooks[k]._obj_.close()
          self.folder_hooks = new_hooks
! 
      def OnDisconnection(self, mode, custom):
          print "SpamAddin - Disconnecting from Outlook"