[Spambayes-checkins] spambayes/spambayes ImapUI.py, 1.40, 1.41 ProxyUI.py, 1.55, 1.56 UserInterface.py, 1.50, 1.51

Tony Meyer anadelonbrin at users.sourceforge.net
Wed Dec 22 01:24:01 CET 2004


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

Modified Files:
	ImapUI.py ProxyUI.py UserInterface.py 
Log Message:
Use new stats manager properly.

Index: ImapUI.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/ImapUI.py,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** ImapUI.py	21 Dec 2004 23:08:51 -0000	1.40
--- ImapUI.py	22 Dec 2004 00:23:58 -0000	1.41
***************
*** 111,115 ****
      """Serves the HTML user interface for the proxies."""
      def __init__(self, cls, imap, pwd, imap_session_class,
!                  lang_manager=None):
          global parm_map
          # Only offer SSL if it is available
--- 111,115 ----
      """Serves the HTML user interface for the proxies."""
      def __init__(self, cls, imap, pwd, imap_session_class,
!                  lang_manager=None, stats=None):
          global parm_map
          # Only offer SSL if it is available
***************
*** 123,127 ****
              del IMAP4_SSL
          UserInterface.UserInterface.__init__(self, cls, parm_map, adv_map,
!                                              lang_manager)
          self.classifier = cls
          self.imap = imap
--- 123,127 ----
              del IMAP4_SSL
          UserInterface.UserInterface.__init__(self, cls, parm_map, adv_map,
!                                              lang_manager, stats)
          self.classifier = cls
          self.imap = imap

Index: ProxyUI.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/ProxyUI.py,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** ProxyUI.py	21 Dec 2004 23:16:28 -0000	1.55
--- ProxyUI.py	22 Dec 2004 00:23:58 -0000	1.56
***************
*** 165,169 ****
          UserInterface.UserInterface.__init__(self, proxy_state.bayes,
                                               parm_ini_map, adv_map,
!                                              proxy_state.lang_manager)
          state = proxy_state
          self.state_recreator = state_recreator # ugly
--- 165,170 ----
          UserInterface.UserInterface.__init__(self, proxy_state.bayes,
                                               parm_ini_map, adv_map,
!                                              proxy_state.lang_manager,
!                                              proxy_state.stats)
          state = proxy_state
          self.state_recreator = state_recreator # ugly

Index: UserInterface.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/UserInterface.py,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** UserInterface.py	21 Dec 2004 23:08:51 -0000	1.50
--- UserInterface.py	22 Dec 2004 00:23:58 -0000	1.51
***************
*** 267,271 ****
  
      def __init__(self, bayes, config_parms=(), adv_parms=(),
!                  lang_manager=None):
          """Load up the necessary resources: ui.html and helmet.gif."""
          BaseUserInterface.__init__(self, lang_manager)
--- 267,271 ----
  
      def __init__(self, bayes, config_parms=(), adv_parms=(),
!                  lang_manager=None, stats=None):
          """Load up the necessary resources: ui.html and helmet.gif."""
          BaseUserInterface.__init__(self, lang_manager)
***************
*** 273,276 ****
--- 273,277 ----
          self.parm_ini_map = config_parms
          self.advanced_options_map = adv_parms
+         self.stats = stats
          self.app_for_version = None # subclasses must fill this in
  
***************
*** 921,933 ****
      def onStats(self):
          """Provide statistics about previous SpamBayes activity."""
-         # Caching this information somewhere would be a good idea,
-         # rather than regenerating it every time.  If people complain
-         # about it being too slow, then do this!
-         # XXX The Stats object should be generated once, when we start up,
-         # XXX and then just called, here.
-         s = Stats.Stats()
          self._writePreamble("Statistics")
!         stats = s.GetStats(use_html=True)
!         stats = self._buildBox("Statistics", None, "<br/><br/>".join(stats))
          self.write(stats)
          self._writePostamble(help_topic="stats")
--- 922,933 ----
      def onStats(self):
          """Provide statistics about previous SpamBayes activity."""
          self._writePreamble("Statistics")
!         if self.stats:
!             stats = self.stats.GetStats(use_html=True)
!             stats = self._buildBox("Statistics", None,
!                                    "<br/><br/>".join(stats))
!         else:
!             stats = self._buildBox("Statistics", None,
!                                    "Statistics not available")
          self.write(stats)
          self._writePostamble(help_topic="stats")



More information about the Spambayes-checkins mailing list