[Mailman-Users] Umbrella Lists & Subject Prefixes

Mark Sapiro msapiro at value.net
Thu Sep 20 20:30:45 CEST 2007


Mike Peachey wrote:
>
>I have managed to stop all sub-lists from re-archiving mails that have 
>been through higher lists by adding an X-No-Archive to mails as soon as 
>they're archived so that they only get archived once.
>
>However, Subject Prefixes are giving me a little more hassle.
>
>Currently, if a message goes through the lists "ListA, ListB and ListC" 
>on their way to a recipient, the subject line looks like this:
>
>Subject: [ListC][ListB][ListA] $subject
>
>This is getting to be an annoyance for many within the company and I 
>would like to get it to ONLY add a subject prefix if it's the first list 
>it's been through. So, if you send to ListA, you get [ListA] instead of 
>[ListC][ListB][ListA] and if you send to ListB you get [ListB] instead 
>of [ListC][ListB].
>
>I have spent a lot of time looking for a solution to this one, but the 
>only solution I found is one from 1999 that might or might not work for 
>this version of Mailman, but my lack of Python skill is letting me down 
>in working it out.


If you yould tell us what the 1999 solution is or give a link to it, we
might be able to tell you if it applies.

However, here's a solution. IIRC, you are using a custom handler to add
the X-No-Archive: header to mail sent from a list so it is received by
subsequent lists with the header and not archived. Thus, you already
have the presence of this header to know if a message has been through
a prior list. And, if you're concerned about the possibility of a
message arriving at the first list with an X-No-Archive: header
already there, you could add an X-Mailman-No-Prefix: or some such
header too.

Now given that the message has a header that identifies it as one not
wanting to be prefixed you need to modify
Mailman/Handlers/CookHeaders.py as follows:

Find the lines (watch for wrapping)

def prefix_subject(mlist, msg, msgdata):
    # Add the subject prefix unless the message is a digest or is being
fast
    # tracked (e.g. internally crafted, delivered to a single user such
as the
    # list admin).
    prefix = mlist.subject_prefix

and add two lines after the comment so it becomes

def prefix_subject(mlist, msg, msgdata):
    # Add the subject prefix unless the message is a digest or is being
fast
    # tracked (e.g. internally crafted, delivered to a single user such
as the
    # list admin).
    if msg.get('x-no-archive', None) == None:
        return
    prefix = mlist.subject_prefix

If you decide to use a header other than X-No-Archive:, you'd replace
'x-no-archive' above with the name of that header.

-- 
Mark Sapiro <msapiro at value.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