[Spambayes-checkins] spambayes/pspam zeo.bat, NONE, 1.1 README.txt, 1.1, 1.2 pop.py, 1.5, 1.6 scoremsg.py, 1.3, 1.4 update.py, 1.3, 1.4 vmspam.ini, 1.1, 1.2

Tony Meyer anadelonbrin at users.sourceforge.net
Thu Dec 18 01:41:54 EST 2003


Update of /cvsroot/spambayes/spambayes/pspam
In directory sc8-pr-cvs1:/tmp/cvs-serv10266/pspam

Modified Files:
	README.txt pop.py scoremsg.py update.py vmspam.ini 
Added Files:
	zeo.bat 
Log Message:
Bring pspam into the modern spambayes world.  update.py, pop.py and scoremsg.py all seem to
work ok for me, with very limited testing.

Let the connection address be either a INET address (in the form "(server,port)", or a UNIX one.

Standardise the options code (move the options into the same place as all the rest, and dump
the pspam only file, which didn't work with the new OptionsClass anyway).  Note that the
options have no nice name or docstring, because I don't really know that I know enough to
fill those out.  They might vanish sometime anyway.

--- NEW FILE: zeo.bat ---
set STUPID_LOG_FILE=c:\windows\temp\zeospam.log
python c:\python23\lib\site-packages\ZEO\start.py -p 8890 c:\windows\temp\zeospam.fs

Index: README.txt
===================================================================
RCS file: /cvsroot/spambayes/spambayes/pspam/README.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** README.txt	4 Nov 2002 04:44:19 -0000	1.1
--- README.txt	18 Dec 2003 06:41:51 -0000	1.2
***************
*** 18,21 ****
--- 18,22 ----
  vmspam.ini -- a sample configuration file
  zeo.sh -- a script to start a ZEO server
+ zeo.bat -- a script to start a ZEO server on Windows
  
  The code depends on ZODB3, which you can download from

Index: pop.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/pspam/pop.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** pop.py	20 Jan 2003 20:24:54 -0000	1.5
--- pop.py	18 Dec 2003 06:41:51 -0000	1.6
***************
*** 45,51 ****
  import zLOG
  
! from tokenizer import tokenize
  import pspam.database
! from pspam.options import options
  
  try:
--- 45,51 ----
  import zLOG
  
! from spambayes.tokenizer import tokenize
  import pspam.database
! from spambayes.Options import options
  
  try:
***************
*** 99,103 ****
          parts = line.split()
          if parts[0] != "USER":
!             self.wfile.write("-ERR Invalid command; must specify USER first")
              return False
          user = parts[1]
--- 99,103 ----
          parts = line.split()
          if parts[0] != "USER":
!             self.wfile.write("-ERR Invalid command; must specify USER first\n")
              return False
          user = parts[1]
***************
*** 311,318 ****
      profile = r["profile"]
  
!     log = open("/var/tmp/pop.log", "ab")
      print >> log, "+PROXY start", time.ctime()
  
!     server = POP3ProxyServer(('', options.proxy_port),
                               POP3RequestHandler,
                               profile.classifier,
--- 311,319 ----
      profile = r["profile"]
  
!     log = open("pop.log", "ab")
      print >> log, "+PROXY start", time.ctime()
  
!     server = POP3ProxyServer(('', int(options["pop3proxy",
!                                               "listen_ports"][0])),
                               POP3RequestHandler,
                               profile.classifier,

Index: scoremsg.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/pspam/scoremsg.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** scoremsg.py	12 Nov 2002 07:03:20 -0000	1.3
--- scoremsg.py	18 Dec 2003 06:41:51 -0000	1.4
***************
*** 2,14 ****
  """Score a message provided on stdin and show the evidence."""
  
  import ZODB
  from ZEO.ClientStorage import ClientStorage
  
! from tokenizer import tokenize
! 
! import email
! import sys
! 
! import pspam.options
  
  try:
--- 2,14 ----
  """Score a message provided on stdin and show the evidence."""
  
+ import sys
+ import email
+ 
  import ZODB
  from ZEO.ClientStorage import ClientStorage
  
! import pspam.database
! from spambayes.Options import options
! from spambayes.tokenizer import tokenize
  
  try:
***************
*** 20,29 ****
  
  def main(fp):
!     cs = ClientStorage("/var/tmp/zeospam")
!     db = ZODB.DB(cs)
      r = db.open().root()
- 
-     # make sure scoring uses the right set of options
-     pspam.options.mergefile("/home/jeremy/src/vmspam/vmspam.ini")
  
      p = r["profile"]
--- 20,25 ----
  
  def main(fp):
!     db = pspam.database.open()
      r = db.open().root()
  
      p = r["profile"]

Index: update.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/pspam/update.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** update.py	12 Nov 2002 07:03:20 -0000	1.3
--- update.py	18 Dec 2003 06:41:51 -0000	1.4
***************
*** 8,12 ****
  import pspam.database
  from pspam.profile import Profile
! from pspam.options import options
  
  try:
--- 8,13 ----
  import pspam.database
  from pspam.profile import Profile
! 
! from spambayes.Options import options
  
  try:
***************
*** 31,45 ****
      if profile is None or rebuild:
          # if there is no profile, create it
!         profile = r["profile"] = Profile(options.folder_dir)
          get_transaction().commit()
  
      # check for new folders of training data
!     for ham in options.ham_folders:
!         p = os.path.join(options.folder_dir, ham)
          if not folder_exists(profile.hams, p):
              profile.add_ham(p)
  
!     for spam in options.spam_folders:
!         p = os.path.join(options.folder_dir, spam)
          if not folder_exists(profile.spams, p):
              profile.add_spam(p)
--- 32,46 ----
      if profile is None or rebuild:
          # if there is no profile, create it
!         profile = r["profile"] = Profile(options["ZODB", "folder_dir"])
          get_transaction().commit()
  
      # check for new folders of training data
!     for ham in options["ZODB", "ham_folders"].split(os.pathsep):
!         p = os.path.join(options["ZODB", "folder_dir"], ham)
          if not folder_exists(profile.hams, p):
              profile.add_ham(p)
  
!     for spam in options["ZODB", "spam_folders"].split(os.pathsep):
!         p = os.path.join(options["ZODB", "folder_dir"], spam)
          if not folder_exists(profile.spams, p):
              profile.add_spam(p)

Index: vmspam.ini
===================================================================
RCS file: /cvsroot/spambayes/spambayes/pspam/vmspam.ini,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** vmspam.ini	4 Nov 2002 04:44:19 -0000	1.1
--- vmspam.ini	18 Dec 2003 06:41:51 -0000	1.2
***************
*** 1,21 ****
! [Train]
  folder_dir: /home/jeremy/Mail
  spam_folders: train/spam
  ham_folders: train/ham
- 
- [Score]
- max_ham: 0.05
- min_spam: 0.99
- 
- [Proxy]
- server: mail.zope.com
- server_port: 110
- proxy_port: 1111
- log_pop_session: true
- log_pop_session_file: /var/tmp/pop.log
- 
- [ZODB]
  zeo_addr: /var/tmp/zeospam
  event_log_file: /var/tmp/zeospam.log
- event_log_severity: 0
- cache_size: 2000
--- 1,6 ----
! [ZODB]
  folder_dir: /home/jeremy/Mail
  spam_folders: train/spam
  ham_folders: train/ham
  zeo_addr: /var/tmp/zeospam
  event_log_file: /var/tmp/zeospam.log





More information about the Spambayes-checkins mailing list