[Mailman-Users] regexp help
savoy at uleth.ca
Mon Nov 2 23:17:34 CET 2009
>Mark Sapiro wrote:
>What you need is a custom handler. See the FAQ at
<http://wiki.list.org/x/l4A9> for how to install one.
Thank you. Done.
>In your case, the handler is very simple - just 9 lines.
>cre = re.compile('unique\.name', re.IGNORECASE)
>def process(mlist, msg, msgdata):
> if mlist.internal_name <> 'abc-l':
> if cre.search(msg.get('to', '')):
> msgdata['approved'] = 1
> # Used by the Emergency module
> msgdata['adminapproved'] = 1
>Of course, you adjust the regexp 'unique\.name' and the list name
>'abc-l' to suit. The handler needs to be in the pipeline before
OK - I made a file called Foo.py and put it in /Mailman/Handlers.
I then inserted this module right before 'Moderate' in the pipeline (I
Defaults.py for this - just as a temporary measure to see if it would
I will remove this and add a line to mm_cfg.py later.
I then stopped/started the Mailman processes (not sure if that's
I did it anyway). Now the test email I sent is stuck in the shunt queue
is in the errors log:
File "/Mailman/Handlers/Foo.py", line 2
cre = re.compile('unique\.name', re.IGNORECASE) def process(mlist,
SyntaxError: invalid syntax
It didn't line up well in this email message, but the carat (^) is
under the 'f' in the "def".
I know diddly about Python (and not that much more about Mailman,
really) so I'm not
sure how to fix the problem. Any ideas? Thanks!
- jim -
More information about the Mailman-Users