[Mailman-Developers] tech docs?

Ricardo Kustner ricardo@miss-janet.com
Fri, 06 Aug 1999 00:24:09 +0200 (CEST)


Hi,

is there some information/docs/draft on the structure in the Mailman source
code? Since the moderate function is an important feature in the mailinglist
we're running, i have a lot of ideas for things that could make the moderate
page more powerfull and easy to work with... i can make my own little hacks in
the source but i could also offer my patches in here... so i can share my code
plus i wont have to put it back everytime i upgrade mailman to a new version ;)

one thing i really wanted to fix fast was stripping a lot of the headers you
see on the moderated posts page... 
this is what i made for it (this it my first piece of python ever so it can be
probably made much more efficient ;) ) It's just a function a call in admindb.py
before it outputs the message on the screen with Preformatted()
ideally this could be a config option and one should be able to choose which
headers to show in the output.

====
def stripheaders(msg):

    found = 0
    emsg = '' 
    # define which headers to keep
    headers = ['From:', 'To:', 'Date:', 'Subject:']

    for i in string.split(msg, "\012"):
        if not found:
            for j in headers:
                if i[:len(j)] == j:
                        emsg = emsg + i + "\012"
            # the first empty line means we're done with the headers part
            if i == "":
                found = 1
                emsg = emsg + "\012"
        else:
            # we've had the header part so every line can be added back
            emsg = emsg + i + "\012"

    return(emsg)
====


Ricardo.

--