[Mailman-Users] regexp help

Savoy, Jim savoy at uleth.ca
Tue Nov 3 23:05:53 CET 2009


Hi Mark,

   I got it to compile properly, but it is still not working.
I made the following changes in Foo.py:

import re
cre = re.compile('test.account', re.IGNORECASE)
def process(mlist, msg, msgdata):
    if mlist.internal_name <> 'abc-l':
        return
    if cre.search(msg.get('to', '')):
        msgdata['approved'] = 1
        # Used by the Emergency module
        msgdata['adminapproved'] = 1


Goal: The account test.account at uleth.ca is set to forward mail to the
mailing
list abc-l at uleth.ca, which should accept it, regardless of who sent it
to
test.account at uleth.ca (all other mail to this list from non-members will
be
rejected).


You also wrote:

>if the contents of the To: header of the message matches the regexp in
>re.compile() case insensitively, then the approved and adminapproved
>flags will be set in the message metadata and the message won't be
>subject to any holds.

So when you say "matches the regexp" do you mean "exactly" matches? And
if so,
would your regexp work? Or do I need a more specific or accompanying
regexp in
the re.compile statement? eg

cre = re.compile('test.account at uleth.ca', re.IGNORECASE)

Thanks.

 - jim -



More information about the Mailman-Users mailing list