[Mailman-Developers] handler to auto detach attachment and link it to a website keeping html

Mark Sapiro mark at msapiro.net
Wed Apr 23 02:35:08 CEST 2014

On 04/22/2014 03:46 AM, Sylvain Viart wrote:
> List configuration question.
> I need to pass some configuration plugin to this handler. Like remote
> ftp parameters. I've seen code like this:
>     if mlist.convert_html_to_plaintext and
> I suppose that I configure it that way:
> /etc/mailman/mm_cfg.py
> HTML_TO_PLAIN_TEXT_COMMAND = 'path/to/converter'
> and in my extend()
> mlist.convert_html_to_plaintext = 1
> is in /var/lib/mailman/lists/mytestlist/extend.py  [debian base path]

If you are doing this as a part of content filtering you just set the
list's Content filtering -> convert_html_to_plaintext to Yes, but I
suspect you are not.

In that case, don't hijack content filtering settings for your own
purpose. It won't work.

If you are going to hard code some setting for your handler to use, just
hard code it in the handler.

> I took it here
> http://wiki.list.org/pages/viewpage.action?pageId=4030615. I used
> extend.py to install my custom handler that way:
> import copy
> from Mailman import mm_cfg
> def extend(mlist):
>   mlist.pipeline = copy.copy(mm_cfg.GLOBAL_PIPELINE)
>   # The next line inserts MyHandler ahead of Moderate.
>   mlist.pipeline.insert(mlist.pipeline.index('Moderate'), 'MyHandler')
> Also, it's indicated that there's a kind of caching involved with the
> Handler's code…:
>> Note however, that the first time Mailman saves the list, the pipeline
>> attribute will be saved along with it, so simply removing extend.py
>> from lists/test-list/ won't remove the special pipeline.

It is not caching per se. Once you access the list once and save it,
your modified pipeline is saved as a list attribute just like any other
setting. Removing extend.py will not remove the pipeline attribute from
the list. That is what the above is trying to tell you.

> I do perform a mailman restart to load new handler's code:
> /etc/init.d/mailman restart

Yes. That is correct.

> Is there some documentation about list configuration override order?

Not outside the source code. See the __init__ method of the MailList
class in Mailman/MailList.py. The list's extend.py if any is executed
before the list's configuration is loaded from disk. Thus any list
attribute set in extend.py that also exists in the list's saved
configuration will be overridden by the list config.

> I found a topic giving some information for personalizing the list:
> 4.48 How can I change the HTML (or .txt) templates used by my mailing
> lists?
> http://wiki.list.org/pages/viewpage.action?pageId=4030605

Which only talks about search rules for the built in templates and has
nothing to do with anything else.

Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

More information about the Mailman-Developers mailing list