[Spambayes-checkins] spambayes/scripts core_server.py, 1.1.2.1, 1.1.2.2

Skip Montanaro montanaro at users.sourceforge.net
Wed May 23 04:18:03 CEST 2007


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

Modified Files:
      Tag: CORESVR
	core_server.py 
Log Message:
now we can import a useless plugin

Index: core_server.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/Attic/core_server.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
*** core_server.py	18 May 2007 03:54:39 -0000	1.1.2.1
--- core_server.py	23 May 2007 02:18:00 -0000	1.1.2.2
***************
*** 59,65 ****
  
  Protocol plugin interface:
-  o POP3
-  o NNTP
   o Classifier for web apps (e.g. Trac, Roundup, Moin)
  
  Web training interface:
--- 59,65 ----
  
  Protocol plugin interface:
   o Classifier for web apps (e.g. Trac, Roundup, Moin)
+  o POP3?
+  o NNTP?
  
  Web training interface:
***************
*** 133,140 ****
          return '%s:%d' % (addr, port)
  
  
  def main(state):
!     """Runs the proxy forever or until a 'KILL' command is received or
      someone hits Ctrl+Break."""
      http_server = UserInterfaceServer(state.ui_port)
      http_server.register(CoreUserInterface(state))
--- 133,149 ----
          return '%s:%d' % (addr, port)
  
+ def load_plugin(name):
+     try:
+         plugin = __import__(name)
+     except ImportError:
+         plugin = __import__("spambayes.%s" % name)
+         plugin = getattr(plugin, name)
+     return plugin.register()
  
  def main(state):
!     """Runs the core server forever or until a 'KILL' command is received or
      someone hits Ctrl+Break."""
+     state.plugin = load_plugin(options["Plugin", "x-module"])
+     print ">>", state.plugin
      http_server = UserInterfaceServer(state.ui_port)
      http_server.register(CoreUserInterface(state))
***************
*** 201,203 ****
  
  if __name__ == '__main__':
!     run()
--- 210,215 ----
  
  if __name__ == '__main__':
!     try:
!         run()
!     except KeyboardInterrupt:
!         print "bye!"



More information about the Spambayes-checkins mailing list