[Spambayes-checkins] spambayes/spambayes CoreUI.py, 1.1.2.4, 1.1.2.5 Options.py, 1.141.2.2, 1.141.2.3 UserInterface.py, 1.61, 1.61.2.1 WebAppPlugin.py, 1.1.2.1, 1.1.2.2

Skip Montanaro montanaro at users.sourceforge.net
Thu May 24 05:19:37 CEST 2007


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

Modified Files:
      Tag: CORESVR
	CoreUI.py Options.py UserInterface.py WebAppPlugin.py 
Log Message:
A start on allowing plugin configuration.  This revealed a chicken-and-egg
situation.  You can't load the plugin before you know what it is.  (I
suppose it really belongs in the basic configuration.)  For the time being
fall back to requiring it on the command line.


Index: CoreUI.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Attic/CoreUI.py,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** CoreUI.py	23 May 2007 02:18:01 -0000	1.1.2.4
--- CoreUI.py	24 May 2007 03:19:34 -0000	1.1.2.5
***************
*** 692,695 ****
--- 692,708 ----
          self._writePostamble()
  
+     def onPluginconfig(self):
+         html = self._buildConfigPage(self.plugin.plugin_map)
+         html.title = _('Home > Plugin Configuration')
+         html.pagename = _('> Plugin Configuration')
+         html.plugin_button.name.value = _("Back to basic configuration")
+         html.plugin_button.action = "config"
+         html.config_submit.value = _("Save plugin options")
+         html.restore.value = _("Restore plugin options defaults")
+         del html.exp_button
+         del html.adv_button
+         self.writeOKHeaders('text/html')
+         self.write(html)
+ 
      def _makeMessageInfo(self, message):
          """Given an email.Message, return an object with subjectHeader,

Index: Options.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Options.py,v
retrieving revision 1.141.2.2
retrieving revision 1.141.2.3
diff -C2 -d -r1.141.2.2 -r1.141.2.3
*** Options.py	23 May 2007 02:18:01 -0000	1.141.2.2
--- Options.py	24 May 2007 03:19:34 -0000	1.141.2.3
***************
*** 1295,1304 ****
       r"\w\w(?:_\w\w)?", RESTORE),
    ),
- 
-   "Plugin" : (
-     ("x-module", _("Plugin module name"), "WebAppPlugin",
-      _("""The name of the plugin module for the core server."""),
-      r"[\w]+", DO_NOT_RESTORE),
-     ),
  }
  
--- 1295,1298 ----

Index: UserInterface.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/UserInterface.py,v
retrieving revision 1.61
retrieving revision 1.61.2.1
diff -C2 -d -r1.61 -r1.61.2.1
*** UserInterface.py	28 Nov 2005 10:53:12 -0000	1.61
--- UserInterface.py	24 May 2007 03:19:34 -0000	1.61.2.1
***************
*** 820,823 ****
--- 820,825 ----
              elif parms["how"] == _("Save experimental options"):
                  pmap = experimental_ini_map
+             elif parms["how"] == _("Save plugin options"):
+                 pmap = self.plugin_ini_map
              del parms["how"]
          html = self._getHTMLClone()

Index: WebAppPlugin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Attic/WebAppPlugin.py,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** WebAppPlugin.py	23 May 2007 02:19:00 -0000	1.1.2.1
--- WebAppPlugin.py	24 May 2007 03:19:34 -0000	1.1.2.2
***************
*** 1,8 ****
  
! from CorePlugin import PlugIn, PlugInUI
  
! class WebAppUI(PlugInUI):
!     pass
  
  def register():
!     return PlugIn("WebApp", WebAppUI())
--- 1,30 ----
  
! from CorePlugin import Plugin, PluginUI
! from spambayes.OptionsClass import *
! from spambayes.Options import _
  
! class WebAppUI(PluginUI):
!     defaults = (
!         ("xmlrpc_path", _("XML-RPC path"), "/sbrpc",
!          _("""The path to respond to."""),
!          r"[\w]+", RESTORE),
!         ("xmlrpc_host", _("XML-RPC host"), "localhost",
!          _("""The host to listen on."""),
!          SERVER, RESTORE),
!         ("xmlrpc_port", _("XML-RPC port"), "8001",
!          _("""The port to listen on."""),
!          r"[\d]+", RESTORE),
!         )
! 
!     def __init__(self):
!         PluginUI.__init__(self)
!         # Configuration options we will offer to users.
!         self.plugin_map = (
!             (_('XML-RPC Options'), None),
!             ('Plugin',            'xmlrpc_path'),
!             ('Plugin',            'xmlrpc_host'),
!             ('Plugin',            'xmlrpc_port'),
!             )
  
  def register():
!     return Plugin("WebApp", WebAppUI())



More information about the Spambayes-checkins mailing list