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

Sylvain Viart sylvain at opensource-expert.com
Tue Apr 22 12:46:19 CEST 2014


Hi,

Seems working… Great.

Le 19/04/2014 20:24, Mark Sapiro a écrit :
> You don't have to do that. If xxx is the base64 encoded image data, all
> you need is
>
>      clip = MIMEImage(xxx, 'png', _encoder=email.encoders.encode_noop)
>      clip['Content-Transfer-Encoding'] = 'base64'

Cool!

The working code I produced is:

from email.mime.image import MIMEImage
from email import encoders
#[…]
     clip = MIMEImage(ATTACH_CLIP, 'png', _encoder=encoders.encode_noop)
     clip['Content-Transfer-Encoding'] = 'base64'
     clip.add_header('Content-ID', '<part1.%s>' % clip_cid)

Thank you. :-)

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 
mm_cfg.HTML_TO_PLAIN_TEXT_COMMAND:


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]

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.

I do perform a mailman restart to load new handler's code:

/etc/init.d/mailman restart


Is there some documentation about list configuration override order?

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


Regards,
Sylvain.


More information about the Mailman-Developers mailing list