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

Modified Files:
      Tag: CORESVR
        core_server.py 
Log Message:
a step closer - actually scored a message!

Index: core_server.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/Attic/core_server.py,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** core_server.py      24 May 2007 03:19:34 -0000      1.1.2.3
--- core_server.py      2 Jun 2007 21:42:08 -0000       1.1.2.4
***************
*** 19,23 ****
          options:
              -h      : Displays this help message.
!             -m module :
                        Identify plugin module to use (required)
              -d FILE : use the named DBM database file
--- 19,23 ----
          options:
              -h      : Displays this help message.
!             -P module :
                        Identify plugin module to use (required)
              -d FILE : use the named DBM database file
***************
*** 135,145 ****
          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):
--- 135,147 ----
          return '%s:%d' % (addr, port)
  
! def load_plugin(name, state):
      try:
!         plugin_module = __import__(name)
      except ImportError:
!         plugin_module = __import__("spambayes.%s" % name)
!         plugin_module = getattr(plugin_module, name)
!     plugin = plugin_module.register()
!     plugin.state = state
!     return plugin
  
  def main(state):
***************
*** 157,161 ****
      # Read the arguments.
      try:
!         opts, args = getopt.getopt(sys.argv[1:], 'hbd:p:l:u:o:m:')
      except getopt.error, msg:
          print >> sys.stderr, str(msg) + '\n\n' + __doc__
--- 159,163 ----
      # Read the arguments.
      try:
!         opts, args = getopt.getopt(sys.argv[1:], 'hbd:p:l:u:o:P:')
      except getopt.error, msg:
          print >> sys.stderr, str(msg) + '\n\n' + __doc__
***************
*** 179,191 ****
          elif opt == '-o':
              options.set_from_cmdline(arg, sys.stderr)
!         elif opt == '-m':
!             state.plugin = load_plugin(arg)
  
      if state.plugin is None:
          print >> sys.stderr, __doc__
          sys.exit()
  
-     state.db_name, state.use_db = storage.database_type(opts)
- 
      # Let the user know what they are using...
      v = get_current_version()
--- 181,192 ----
          elif opt == '-o':
              options.set_from_cmdline(arg, sys.stderr)
!         elif opt == '-P':
!             state.plugin = load_plugin(arg, state)
  
      if state.plugin is None:
+         print >> sys.stderr, "No plugin argument (-P) was given."
          print >> sys.stderr, __doc__
          sys.exit()
  
      # Let the user know what they are using...
      v = get_current_version()

_______________________________________________
Spambayes-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/spambayes-checkins

Reply via email to