[Mailman-Users] Receiving filtered commit messages via a Handler

Alexander Shopov al_shopov at yahoo.com
Sun Jul 27 13:23:58 CEST 2008


Hi guys,

I am the coordinator of the Bulgarian Gnome translation team. We have an
internal Mailman controlled list that we use for automatic notifications
via mail from internal staging VCS repositories and bug tracking
systems.

Currently I would like to add notifications from upstream vcs - KDE and
GNOME. Both projects have commit mailing lists that I will subscribe our
notification list to.

However the volume from upstream commit lists is really great and I need
to apply some filtering.

I made the following Handler:

-------------------------
import re
from Mailman import Errors

def process(mlist, msg, msgdata):

    message_text=msg.as_string()
    recepients = msg.get_all('To')

    # GNOME
    rGNOME=re.compile('/bg\\.po')
    aGnome='svn-commits-list at gnome.org'

    try:
        i = recepients.index(aGnome)
        # To GNOME, so check body
        if None==rGNOME.search(message_text):
            # Discard! Does not contain what we want
            raise Errors.DiscardMessage('GNOME commit - not bg translation')
    except ValueError:
        # OK - not GNOME svn
        pass

    # KDE
    rKDE=re.compile('/bg/(doc)?messages')
    aKDE='kde-commits at kde.org'
    
    try:
        i = recepients.index(aKDE)
        # To KDE, so check subject
        if None==rKDE.search(msg.get('subject')):
            # Discard! Does not contain what we want
            raise Errors.DiscardMessage('KDE commit - not bg translation')
    except ValueError:
        # OK - not KDE svn
        pass

-------------------------

Now comes the part I do not understand - how do I ensure that mailman will accept messages that were posted to the commit lists - they all have different 'From:' field (the identifier of the committer).
What can I do to ensure that commit messages via the upstream lists are accepted by may mailman instance?


Kind regards:
al_shopov


      


More information about the Mailman-Users mailing list