Home > Mailman > Mailman: Preventing Duplicate Archiving and Multiple Subject Prefixes with Umbrella Lists

Mailman: Preventing Duplicate Archiving and Multiple Subject Prefixes with Umbrella Lists

This defines the process of deleting any existing X-No-Archive and X-No-Subject-Prefix headers to prevent duplication, followed by the addition of an X-No-Archive: Yes header and an X-No-Subject-Prefix: Yes header.

~mailman/Mailman/Handlers/Umbrella.py:

def process(mlist, msg, msgdata):
    del msg['x-no-archive']
    msg['X-No-Archive'] = 'Yes'
    del msg['x-no-subject-prefix']
    msg['X-No-Subject-Prefix'] = 'Yes'

The following then inserts that handler into the message pipeline after archiving so that when a message is archived once (in the first list it hits) it is marked not to be archived again in any subsequent lists it is sent to.

~mailman/Mailman/mm_cfg.py:

GLOBAL_PIPELINE.insert(GLOBAL_PIPELINE.index('AfterDelivery'), 'Umbrella')

Mailman doesn’t archive messages containing an X-No-Archive header, however it doesn’t know about the X-No-Subject-Prefix header, so we have to tell it in ~mailman/Mailman/Handlers/CookHeaders.py:

Patch

*** CookHeaders.py.old  2007-09-21 10:33:33.000000000 +0100
--- CookHeaders.py      2007-09-21 10:10:38.000000000 +0100
***************
*** 217,224 ****
--- 217,226 ----
  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.has_key('x-no-subject-prefix') and msg.get('x-no-subject-prefix', '').lower() == 'yes':
+         return
      prefix = mlist.subject_prefix
      subject = msg.get('subject', '')
      # Try to figure out what the continuation_ws is for the header
      if isinstance(subject, Header):
Be Sociable, Share!
Categories: Mailman Tags: , ,
  1. svante
    September 8th, 2009 at 23:55 | #1

    Hi there, this is really good stuff, I’m getting really annoyed at the duplicate subject prefixes when using umbrella lists. But… I cant find Umbrella.Py in my Handlers dir…

  2. svante
    September 9th, 2009 at 00:01 | #2

    Ah, now I get it, you mean create Umbrella.Py…? I’m trying this now and get this error:

    ImportError: No module named Umbrella

  3. September 9th, 2009 at 09:39 | #3

    @svante

    Did you restart Mailman after making the modifications? I believe it creates the pyc files at startup but I could be wrong. It’s been quite a while since I made these modifications (2 years in fact).

  1. No trackbacks yet.

Note: Commenter is allowed to use '@User+blank' to automatically notify your reply to other commenter. e.g, if ABC is one of commenter of this post, then write '@ABC '(exclude ') will automatically send your comment to ABC. Using '@all ' to notify all previous commenters. Be sure that the value of User should exactly match with commenter's name (case sensitive).