Package Dspam

A high level framework for using dspam from a python application. More...

Classes

class  DSpamDirectory
 Operations on the DSPAM directory. More...

Functions

def file_lock
def create_signature_id
 Create a mostly unique tag for a signature.
def put_signature
 Add signature to database.
def _tag_part
 Add tag to a non-multipart message.
def add_signature_tag
 Add DSPAM tag to message.
def extract_signature_tags
 Extract all DSPAM tags from a message.
def parse_groups
 Parse old group file.
def convert_eol
 Convert message to unix end of line conventions.

Variables

string VERSION = "1.3"
tuple _seq_lock = thread.allocate_lock()
int _seq = 0

Detailed Description

A high level framework for using dspam from a python application.

The Dspam module currently hardwires the "hash" storage driver. This driver generally requires that your application have an effective group id of "mail", and have a umask that will allow other applications in the mail group read/write/execute access.


Function Documentation

def Dspam._tag_part (   msg,
  sigkey 
) [private]

Add tag to a non-multipart message.

def Dspam.add_signature_tag (   msg,
  sigkey,
  prob = None,
  factors = None 
)

Add DSPAM tag to message.

We do this the old htmlish way.

Parameters:
msg the original message to tag
sigkey the signature tag
prob probability for X-Dspam-Score header field if supplied
factors factors for X-Dspam-Factors header field if supplied
def Dspam.convert_eol (   txt  ) 

Convert message to unix end of line conventions.

Parameters:
txt the original message
Returns:
the message with '
' as line separator
def Dspam.create_signature_id (  ) 

Create a mostly unique tag for a signature.

def Dspam.extract_signature_tags (   txt  ) 

Extract all DSPAM tags from a message.

def Dspam.parse_groups (   groupfile,
  dups = False 
)

Parse old group file.

This version parses the old dspam-2.6 group file, which we will keep around a while for compatibility. Syntax is very simple:

 group1: user1,user2
 group2: user1,user3,user4
 

returns the map:

 { 'user1': ['group1','group2'],
   'user2': ['group1'],
   'user3': ['group2'],
   'user4': ['group2'] }
 
def Dspam.put_signature (   ds,
  sig,
  sigfile = None 
)

Add signature to database.

By default, use the signature database provided by the dspam database driver. If sigfile is supplied, it is a bsdddb database that we manage ourselves (including purging old entries, since dspam no longer does that). I suspect we do not really need the bsddb option, but it is there for now.

Parameters:
ds the dspam.ctx
sig the signature from the dspam.ctx
sigfile if given, a bsddb database to use instead of the dspam driver

Generated on 15 Feb 2015 for pydspam by  doxygen 1.6.1