[Mailman-Users] Private Lists with Real Name Signatures

Doug Gaff doug.gaff at gmail.com
Wed Feb 2 05:59:48 CET 2011


Hi all,

I thought I'd send a summary of this in case anyone else needs to do it.
Thanks to Mark for basically explaining all of this to me.

As a reminder of my original request, I have one of my lists set up in
anonymous mode, but the list owner wants emails signed with "handles" used
by folks on the list. For example, "bikerchick21 says:" followed by the rest
of her message. When this anonymous list was setup, the owner put all of the
handles into the Real Name field for each subscriber in the subscriber list.
Now, I want to use this Real Name field in the msg_header variable on the
non-digest admin page. Here are the steps:

1. Create Fromvar.py (my choice for the handler name) in the
Mailman/Handlers directory. This code attempts to pull Real Name from the
subscriber list first by matching the from email address with the list. If
the mailman Real Name field is empty, it attempts to pull Real Name from the
sender's email address. (Customer handler FAQ: http://wiki.list.org/x/l4A9)
In the latter case my code just leaves the field blank to keep it either
handles or nothing.

from email.Utils import parseaddr
def process(mlist, msg, msgdata):
    from_name, addrs = parseaddr(msg['from'])
    if mlist.isMember(addrs):
        poster_name = mlist.getMemberName(addrs) or ''
    if not poster_name:
        poster_name = from_name
    msgdata.setdefault('decoration-data', {}).update(
                                  poster_name=poster_name)


2. Add this new handler to the global pipeline by editing the
Mailman/mm_cfg.py file at the end:

##################################################
# Put YOUR site-specific settings below this line.
GLOBAL_PIPELINE.insert(GLOBAL_PIPELINE.index('Cleanse'), 'Fromvar')


3. Stop and start mailman. If things worked, you'll have updated Fromvar.pyc
and mm_cfg.pyc files.


4. In the admin page under non-digest options, you can use "poster_name" in
the msg_header or msg_footer areas. To do the bikerchick21 example,
msg_header would have this:

%(poster_name)s says:


5. (Optional) When you Submit the change on the non-digest admin page,
you'll get a warning about "poster_name" being an illegal substitution
variable. You can ignore this, or you can change code in NonDigest.py. From
Mark:

Modify Mailman/Gui/NonDigest.py. after the lines

    def _setValue(self, mlist, property, val, doc):
        alloweds = list(ALLOWEDS)

add

        alloweds.append('poster_name')

If you make this change, stop/start mailman again. I can live with the
warning, so I didn't bother.


Finally, please note that HTML-formatted messages (e.g. from Outlook or
gmail interface) will have trouble with headers and footers as pointed out
in http://wiki.list.org/x/84A9. 

HTH,

Doug



More information about the Mailman-Users mailing list