[Mailman-Users] Regular expressions in list config files?

bernholdtde at ornl.gov bernholdtde at ornl.gov
Tue Feb 19 16:12:46 CET 2008


Our corporate mail gateway adds a header to flag things it believes
are spam.  I'd like to be able to take advantage of this in my Mailman
lists.  I'm having some problems setting the header_filter_rules
properly.

If I use a simple regex, like 
			 '^x-spam-flag: *yes'
it seems to show up properly in the configuration.  But if I use a
more precise regex that accounts for all forms of whitespace with the
"\s" sequence, like this
		     '^\s*x-spam-flag:\s*yes\s*$'
then what appears in the config file is 
		   '^\\s*x-spam-flag:\\s*yes\\s*$'
in other words the backslashes have been quoted and are now literals.

I have tried this through the web U/I and using config_list and I get
the same result.  It seems pretty clear that both interfaces are
sanitizing inputs by quoting things that could cause problems, but I
haven't dug deep enough to find where that's happening. (I don't
really want to have to customize Mailman for something like this.)

I was surprised that I couldn't find any other mention of these kinds
of problems, and that the only examples people were using to
illustrate the use of regexes in Mailman config files didn't involves
special sequences like "\s".  Is anyone else using more sophisticed
REs successfully?  Is there some trick or Python arcana that I'm
missing (I know barely enough Python to get _into_ a paper bag)?

I haven't verified, but I assume the same treatment is applied to any
config field that can take a regex.

Thanks in advance for any help.
--
David E. Bernholdt                   |   Email: bernholdtde at ornl.gov 
Oak Ridge National Laboratory        |   Phone: +1 (865) 574 3147    
http://www.csm.ornl.gov/~bernhold/   |   Fax:   +1 (865) 576 5491


More information about the Mailman-Users mailing list