[Mailman-Users] 'Dynamic' footer

Mark Sapiro mark at msapiro.net
Thu Mar 13 16:28:06 CET 2014


On 03/13/2014 02:40 AM, Rodti MacLeary wrote:
> 
> While I appreciate that the Mailman tags available to the footer can be
> useful for adding list admin info etc into the footer, it would be nice
> to be able to inject scripted or dynamic content in there.  Even if the
> footer could be persuaded to read a text file (like the other template
> files) then that text file could be updated.


For Mailman 2.1, the Mailman/Handlers/Decorate.py module (called by
SMTPDirect.py during outgoing message processing) augments the
replacement dictionary for headers and footers from a 'decoration-data'
dictionary in the messages metadata if it exists.

Thus, you can create a custom handler (see
<http://wiki.list.org/x/l4A9>) and insert it in the pipeline before
ToOutgoing to make the appropriate dictionary and add it to the metadata.

E.g., it could do something like

    ... build dynamic_content ...
    msgdata.decoration-data = {'mystuff': dynamic_content}

Then, a %(mystuff)s replacement in the footer would be replaced by the
dynamic content built by the custom handler.

-- 
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-Users mailing list