[Mailman-Users] Simple notification handler
Yves Moisan
yves.moisan at boreal-is.com
Thu Dec 22 20:42:29 CET 2011
Hi Mark,
It seems the handler stops the list from working. When I delete the new
pipeline the list works fine so it's the Python file (or the way I
included it in the pipeline ?) that has a problem.
I've tried including a she-bang line or not (see below for both the
handler and the text file used to shove it in the list pipeline),
importing Message in addition to UserNotification and a few other things
to no avail. One thing I find odd is that the handler doesn't get a
.pyc file upon restart. Should I expect that or does it get created the
first time it is invoked ?
I've copied the file over from a windows machine and I took care of
chowning it so it has the same permissions as the other Handlers. The
file looks ok in vi. What other options do I have before pdb ?
Thanx,
Yves Moisan
=== BackupErrors.py ===
#!/usr/bin/python # I also treid without, like in the other handlers on
my server
# BackupErrors.py
"""Add a list specific alert generator in case there was a problem in
the backup, in which case the Subject of the email will contain the word
'ERROR'
"""
import re
from Mailman import Utils
from Mailman.Message import UserNotification
# from Mailman.Message import Message,UserNotification
NTEXT = """Texte du corps du
message
TESTS.
"""
NRECIP = 'xyz at example.com'
NFROM = 'abc at example.com'
NSUBJ = 'Error in backup'
def process(mlist, msg, msgdata):
subject = Utils.oneline(msg['subject'], 'us-ascii')
if re.search('.*error.*', subject, re.IGNORECASE)
nmsg = UserNotification(NRECIP, NFROM, NSUBJ, NTEXT)
nmsg.send(mlist)
=== backupHandlerPipeline.txt ===
mlist.pipeline = [
# These are the modules that do tasks common to all delivery paths.
'SpamDetect',
'Approve',
'Replybot',
'BackupErrors',
'Moderate',
'Hold',
'MimeDel',
'Scrubber',
'Emergency',
'Tagger',
'CalcRecips',
'AvoidDuplicates',
'Cleanse',
'CleanseDKIM',
'CookHeaders',
# And now we send the message to the digest mbox file, and to the
arch and
# news queues. Runners will provide further processing of the message,
# specific to those delivery paths.
'ToDigest',
'ToArchive',
'ToUsenet',
# Now we'll do a few extra things specific to the member delivery
# (outgoing) path, finally leaving the message in the outgoing queue.
'AfterDelivery',
'Acknowledge',
'ToOutgoing',
]
More information about the Mailman-Users
mailing list