[Pkg-mailman-hackers] Pkg-mailman commit - rev 61 - in trunk/debian: . contrib

Laszlo Boszormenyi gcs-guest@haydn.debian.org
Thu, 15 Apr 2004 16:18:00 -0600


Author: gcs-guest
Date: 2004-04-15 16:17:58 -0600 (Thu, 15 Apr 2004)
New Revision: 61

Modified:
   trunk/debian/README.Debian
   trunk/debian/changelog
   trunk/debian/contrib/SpamAssassin.py
   trunk/debian/contrib/spamd.py
Log:
Update SpamAssassin handler, hopefully will solve #243810 as well.


Modified: trunk/debian/README.Debian
===================================================================
--- trunk/debian/README.Debian	2004-04-15 19:24:29 UTC (rev 60)
+++ trunk/debian/README.Debian	2004-04-15 22:17:58 UTC (rev 61)
@@ -97,7 +97,11 @@
 
 GLOBAL_PIPELINE.insert(1, 'SpamAssassin')
 
-to your mm_cfg.py should enable it.
+to your mm_cfg.py should enable it. You can read more documentation about
+howto configure SpamAssassin and Mailman together at
+http://www.daa.com.au/~james/articles/mailman-spamassassin/
+The current version of this handler used in this package is released on
+2003 May 6 by James Henstridge <james@daa.com.au>.
 
 Upgrading from Mailman 2.x (where x < 1)
 ----------------------------------------

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2004-04-15 19:24:29 UTC (rev 60)
+++ trunk/debian/changelog	2004-04-15 22:17:58 UTC (rev 61)
@@ -11,6 +11,8 @@
     (by GCS, closes: #224319).
   * postfix-to-mailman.py: Fix ',' obscuring illegal invocations, reported
     by martin f krafft <madduck@debian.org> (bsb, closes: #243908)
+  * Update SpamAssassin handler to the most recent version can be found,
+    and document it in README.Debian (by GCS, closes: #235667).
 
  -- Siggy Brentrup <bsb@debian.org>  Thu, 15 Apr 2004 21:19:39 +0200
 

Modified: trunk/debian/contrib/SpamAssassin.py
===================================================================
--- trunk/debian/contrib/SpamAssassin.py	2004-04-15 19:24:29 UTC (rev 60)
+++ trunk/debian/contrib/SpamAssassin.py	2004-04-15 22:17:58 UTC (rev 61)
@@ -42,9 +42,10 @@
 
 class SpamAssassinHold(Errors.HoldMessage):
     '''The message was scored above the hold threshold'''
-    reason = 'SpamAssassin identified this message as possible spam'
     def __init__(self, score=-1, symbols=''):
         Errors.HoldMessage.__init__(self)
+        self.reason = 'SpamAssassin identified this message as possible ' \
+                      'spam (score %g)' % score
         self.rejection = 'Your message was held for moderation because ' \
                          'SpamAssassin gave the message a score of %g ' \
                          'for the following reasons:\n\n%s' % \

Modified: trunk/debian/contrib/spamd.py
===================================================================
--- trunk/debian/contrib/spamd.py	2004-04-15 19:24:29 UTC (rev 60)
+++ trunk/debian/contrib/spamd.py	2004-04-15 22:17:58 UTC (rev 61)
@@ -18,7 +18,7 @@
 or tag messages.
 
 Usage is as follows:
-  >>> conn = spamd.SPAMD()
+  >>> conn = spamd.SpamdConnection()
   >>> conn.addheader('User', 'username')
   >>> conn.check(spamd.SYMBOLS, 'From: user@example.com\n...')
   >>> print conn.getspamstatus()
@@ -29,8 +29,13 @@
 
 import socket
 import mimetools, StringIO
-import string
 
+import __builtin__
+if not hasattr(__builtin__, 'True'):
+    __builtin__.True = (1 == 1)
+    __builtin__.False = (1 != 1)
+del __builtin__
+
 class error(Exception): pass
 
 SPAMD_PORT = 783
@@ -71,20 +76,20 @@
 
     def __init__(self, host='', port=0):
         if not port and ':' in host:
-            host, port = string.split(host, ':', 1)
+            host, port = host.split(':', 1)
             port = int(port)
         if host: self.host = host
         if port: self.port = port
 
         # message structure to hold request headers
-        self.request_headers = mimetools.Message(StringIO.StringIO(), seekable=0)
+        self.request_headers = mimetools.Message(StringIO.StringIO(), seekable=False)
         self.request_headers.fp = None
 
         # stuff that will be filled in after check()
         self.server_version = None
         self.result_code = None
         self.response_message = None
-        self.response_headers = mimetools.Message(StringIO.StringIO(), seekable=0)
+        self.response_headers = mimetools.Message(StringIO.StringIO(), seekable=False)
 
     def addheader(self, header, value):
         '''Adds a header to the request.'''
@@ -116,6 +121,8 @@
         fp = sock.makefile('rb')
         response = fp.readline()
         words = response.split(None, 2)
+        if len(words) != 3:
+            raise error('not enough words in response header')
         if words[0][:6] != 'SPAMD/':
             raise error('bad protocol name in response string')
         self.server_version = float(words[0][6:])
@@ -127,7 +134,7 @@
 
         try:
             # parse header
-            self.response_headers = mimetools.Message(fp, seekable=0)
+            self.response_headers = mimetools.Message(fp, seekable=False)
             self.response_headers.fp = None
         except IOError:
             raise error('could not read in response headers')
@@ -138,7 +145,6 @@
         except IOError:
             raise error('could not read in response message')
             
-
         fp.close()
         sock.close()