Savoy, Jim wrote: >>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. > >>import re >>cre = re.compile('unique\.name', 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 > >>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 >>Moderate. > >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 >editted >Defaults.py for this - just as a temporary measure to see if it would >work). >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 >necessary, but >I did it anyway). Now the test email I sent is stuck in the shunt queue >and this >is in the errors log: > >File "/Mailman/Handlers/Foo.py", line 2 > cre = re.compile('unique\.name', re.IGNORECASE) def process(mlist, >msg, msgdata): > ^ > SyntaxError: invalid syntax
You used some kind of word processor to create foo.py that concatenated lines 2 and 3 into a single line. Your Foo.py file must be just like my original example with lines 1, 2 and 3 at the left margin, lines 4 and 6 indented 4 spaces and lines 5, 7, 8 and 9 indented 8 spaces. -- Mark Sapiro <m...@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan ------------------------------------------------------ Mailman-Users mailing list Mailman-Users@python.org http://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://wiki.list.org/x/AgA3 Security Policy: http://wiki.list.org/x/QIA9 Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/ Unsubscribe: http://mail.python.org/mailman/options/mailman-users/archive%40jab.org